diff options
Diffstat (limited to 'src/librustc_interface')
| -rw-r--r-- | src/librustc_interface/interface.rs | 5 | ||||
| -rw-r--r-- | src/librustc_interface/passes.rs | 13 | ||||
| -rw-r--r-- | src/librustc_interface/queries.rs | 5 | ||||
| -rw-r--r-- | src/librustc_interface/tests.rs | 42 |
4 files changed, 33 insertions, 32 deletions
diff --git a/src/librustc_interface/interface.rs b/src/librustc_interface/interface.rs index d00875f6fee..9cd9eb66cf6 100644 --- a/src/librustc_interface/interface.rs +++ b/src/librustc_interface/interface.rs @@ -12,6 +12,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::sync::Lrc; use rustc_data_structures::OnDrop; use rustc_errors::registry::Registry; +use rustc_lint::LintStore; use rustc_parse::new_parser_from_source_str; use rustc_span::edition; use rustc_span::source_map::{FileLoader, FileName, SourceMap}; @@ -36,7 +37,7 @@ pub struct Compiler { pub(crate) output_dir: Option<PathBuf>, pub(crate) output_file: Option<PathBuf>, pub(crate) crate_name: Option<String>, - pub(crate) register_lints: Option<Box<dyn Fn(&Session, &mut lint::LintStore) + Send + Sync>>, + pub(crate) register_lints: Option<Box<dyn Fn(&Session, &mut LintStore) + Send + Sync>>, pub(crate) override_queries: Option<fn(&Session, &mut ty::query::Providers<'_>, &mut ty::query::Providers<'_>)>, } @@ -136,7 +137,7 @@ pub struct Config { /// /// Note that if you find a Some here you probably want to call that function in the new /// function being registered. - pub register_lints: Option<Box<dyn Fn(&Session, &mut lint::LintStore) + Send + Sync>>, + pub register_lints: Option<Box<dyn Fn(&Session, &mut LintStore) + Send + Sync>>, /// This is a callback from the driver that is called just after we have populated /// the list of queries. diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs index 9119466cbc0..67f9819f331 100644 --- a/src/librustc_interface/passes.rs +++ b/src/librustc_interface/passes.rs @@ -27,6 +27,7 @@ use rustc_errors::PResult; use rustc_expand::base::ExtCtxt; use rustc_hir::def_id::{CrateNum, LOCAL_CRATE}; use rustc_incremental; +use rustc_lint::LintStore; use rustc_mir as mir; use rustc_parse::{parse_crate_from_file, parse_crate_from_source_str}; use rustc_passes::{self, hir_stats, layout_test}; @@ -100,7 +101,7 @@ declare_box_region_type!( /// Returns `None` if we're aborting after handling -W help. pub fn configure_and_expand( sess: Lrc<Session>, - lint_store: Lrc<lint::LintStore>, + lint_store: Lrc<LintStore>, metadata_loader: Box<MetadataLoaderDyn>, krate: ast::Crate, crate_name: &str, @@ -150,10 +151,10 @@ impl BoxedResolver { pub fn register_plugins<'a>( sess: &'a Session, metadata_loader: &'a dyn MetadataLoader, - register_lints: impl Fn(&Session, &mut lint::LintStore), + register_lints: impl Fn(&Session, &mut LintStore), mut krate: ast::Crate, crate_name: &str, -) -> Result<(ast::Crate, Lrc<lint::LintStore>)> { +) -> Result<(ast::Crate, Lrc<LintStore>)> { krate = sess.time("attributes_injection", || { rustc_builtin_macros::cmdline_attrs::inject( krate, @@ -214,7 +215,7 @@ pub fn register_plugins<'a>( fn configure_and_expand_inner<'a>( sess: &'a Session, - lint_store: &'a lint::LintStore, + lint_store: &'a LintStore, mut krate: ast::Crate, crate_name: &str, resolver_arenas: &'a ResolverArenas<'a>, @@ -420,7 +421,7 @@ fn configure_and_expand_inner<'a>( pub fn lower_to_hir<'res, 'tcx>( sess: &'tcx Session, - lint_store: &lint::LintStore, + lint_store: &LintStore, resolver: &'res mut Resolver<'_>, dep_graph: &'res DepGraph, krate: &'res ast::Crate, @@ -705,7 +706,7 @@ impl<'tcx> QueryContext<'tcx> { pub fn create_global_ctxt<'tcx>( compiler: &'tcx Compiler, - lint_store: Lrc<lint::LintStore>, + lint_store: Lrc<LintStore>, hir_forest: &'tcx map::Forest<'tcx>, mut resolver_outputs: ResolverOutputs, outputs: OutputFilenames, diff --git a/src/librustc_interface/queries.rs b/src/librustc_interface/queries.rs index 7de1c36ce4b..bd9717d3f3d 100644 --- a/src/librustc_interface/queries.rs +++ b/src/librustc_interface/queries.rs @@ -4,8 +4,6 @@ use crate::passes::{self, BoxedResolver, QueryContext}; use rustc::arena::Arena; use rustc::dep_graph::DepGraph; use rustc::hir::map; -use rustc::lint; -use rustc::lint::LintStore; use rustc::session::config::{OutputFilenames, OutputType}; use rustc::session::Session; use rustc::ty::steal::Steal; @@ -15,6 +13,7 @@ use rustc_codegen_utils::codegen_backend::CodegenBackend; use rustc_data_structures::sync::{Lrc, Once, WorkerLocal}; use rustc_hir::def_id::LOCAL_CRATE; use rustc_incremental::DepGraphFuture; +use rustc_lint::LintStore; use std::any::Any; use std::cell::{Ref, RefCell, RefMut}; use std::mem; @@ -133,7 +132,7 @@ impl<'tcx> Queries<'tcx> { let crate_name = self.crate_name()?.peek().clone(); let krate = self.parse()?.take(); - let empty: &(dyn Fn(&Session, &mut lint::LintStore) + Sync + Send) = &|_, _| {}; + let empty: &(dyn Fn(&Session, &mut LintStore) + Sync + Send) = &|_, _| {}; let result = passes::register_plugins( self.session(), &*self.codegen_backend().metadata_loader(), diff --git a/src/librustc_interface/tests.rs b/src/librustc_interface/tests.rs index c2e9c35fcd4..ec75a1c6a39 100644 --- a/src/librustc_interface/tests.rs +++ b/src/librustc_interface/tests.rs @@ -2,7 +2,7 @@ extern crate getopts; use crate::interface::parse_cfgspecs; -use rustc::lint; +use rustc::lint::Level; use rustc::middle::cstore; use rustc::session::config::{build_configuration, build_session_options, to_crate_config}; use rustc::session::config::{rustc_optgroups, ErrorOutputType, ExternLocation, Options, Passes}; @@ -186,24 +186,24 @@ fn test_lints_tracking_hash_different_values() { let mut v3 = Options::default(); v1.lint_opts = vec![ - (String::from("a"), lint::Allow), - (String::from("b"), lint::Warn), - (String::from("c"), lint::Deny), - (String::from("d"), lint::Forbid), + (String::from("a"), Level::Allow), + (String::from("b"), Level::Warn), + (String::from("c"), Level::Deny), + (String::from("d"), Level::Forbid), ]; v2.lint_opts = vec![ - (String::from("a"), lint::Allow), - (String::from("b"), lint::Warn), - (String::from("X"), lint::Deny), - (String::from("d"), lint::Forbid), + (String::from("a"), Level::Allow), + (String::from("b"), Level::Warn), + (String::from("X"), Level::Deny), + (String::from("d"), Level::Forbid), ]; v3.lint_opts = vec![ - (String::from("a"), lint::Allow), - (String::from("b"), lint::Warn), - (String::from("c"), lint::Forbid), - (String::from("d"), lint::Deny), + (String::from("a"), Level::Allow), + (String::from("b"), Level::Warn), + (String::from("c"), Level::Forbid), + (String::from("d"), Level::Deny), ]; assert!(v1.dep_tracking_hash() != v2.dep_tracking_hash()); @@ -222,17 +222,17 @@ fn test_lints_tracking_hash_different_construction_order() { let mut v2 = Options::default(); v1.lint_opts = vec![ - (String::from("a"), lint::Allow), - (String::from("b"), lint::Warn), - (String::from("c"), lint::Deny), - (String::from("d"), lint::Forbid), + (String::from("a"), Level::Allow), + (String::from("b"), Level::Warn), + (String::from("c"), Level::Deny), + (String::from("d"), Level::Forbid), ]; v2.lint_opts = vec![ - (String::from("a"), lint::Allow), - (String::from("c"), lint::Deny), - (String::from("b"), lint::Warn), - (String::from("d"), lint::Forbid), + (String::from("a"), Level::Allow), + (String::from("c"), Level::Deny), + (String::from("b"), Level::Warn), + (String::from("d"), Level::Forbid), ]; assert_eq!(v1.dep_tracking_hash(), v2.dep_tracking_hash()); |
