From 0ae2aa232047e16019d1b90726ca2c397371e5aa Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Thu, 26 Jul 2018 16:18:06 -0600 Subject: [PATCH] Use diagnostic API on Session --- src/librustc/session/mod.rs | 2 +- src/librustc_codegen_utils/codegen_backend.rs | 2 +- src/librustc_driver/driver.rs | 2 +- src/librustc_passes/ast_validation.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs index 3b96455424335..0173c4933f821 100644 --- a/src/librustc/session/mod.rs +++ b/src/librustc/session/mod.rs @@ -965,7 +965,7 @@ impl Session { } pub fn teach(&self, code: &DiagnosticId) -> bool { - self.opts.debugging_opts.teach && self.parse_sess.span_diagnostic.must_teach(code) + self.opts.debugging_opts.teach && self.diagnostic().must_teach(code) } /// Are we allowed to use features from the Rust 2018 edition? diff --git a/src/librustc_codegen_utils/codegen_backend.rs b/src/librustc_codegen_utils/codegen_backend.rs index 7e726f00b0bf1..ae8f65303a7fe 100644 --- a/src/librustc_codegen_utils/codegen_backend.rs +++ b/src/librustc_codegen_utils/codegen_backend.rs @@ -116,7 +116,7 @@ impl CodegenBackend for MetadataOnlyCodegenBackend { match *cty { CrateType::Rlib | CrateType::Dylib | CrateType::Executable => {}, _ => { - sess.parse_sess.span_diagnostic.warn( + sess.diagnostic().warn( &format!("LLVM unsupported, so output type {} is not supported", cty) ); }, diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 27b747c633cfe..805a5ecd99130 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -1133,7 +1133,7 @@ where // Unresolved macros might be due to mistyped `#[macro_use]`, // so abort after checking for unknown attributes. (#49074) if resolver.found_unresolved_macro { - sess.parse_sess.span_diagnostic.abort_if_errors(); + sess.diagnostic().abort_if_errors(); } // Lower ast -> hir. diff --git a/src/librustc_passes/ast_validation.rs b/src/librustc_passes/ast_validation.rs index c6bad9e1980fb..0ea90e7453190 100644 --- a/src/librustc_passes/ast_validation.rs +++ b/src/librustc_passes/ast_validation.rs @@ -32,7 +32,7 @@ struct AstValidator<'a> { impl<'a> AstValidator<'a> { fn err_handler(&self) -> &errors::Handler { - &self.session.parse_sess.span_diagnostic + &self.session.diagnostic() } fn check_lifetime(&self, ident: Ident) {