// warn on lints, that are included in `rust-lang/rust`s bootstrap
#![warn(rust_2018_idioms, unused_lifetimes)]
// warn on rustc internal lints
-#![deny(rustc::internal)]
+#![warn(rustc::internal)]
// FIXME: switch to something more ergonomic here, once available.
// (Currently there is no way to opt into sysroot crates without `extern crate`.)
extern crate rustc_span;
use rustc_interface::interface;
-use rustc_session::Session;
+use rustc_session::parse::ParseSess;
use rustc_span::symbol::Symbol;
use rustc_tools_util::VersionInfo;
assert_eq!(arg_value(args, "--foo", |_| true), None);
}
-fn track_clippy_args(sess: &Session, args_env_var: &Option<String>) {
- sess.parse_sess.env_depinfo.borrow_mut().insert((
+fn track_clippy_args(parse_sess: &mut ParseSess, args_env_var: &Option<String>) {
+ parse_sess.env_depinfo.get_mut().insert((
Symbol::intern("CLIPPY_ARGS"),
args_env_var.as_deref().map(Symbol::intern),
));
impl rustc_driver::Callbacks for RustcCallbacks {
fn config(&mut self, config: &mut interface::Config) {
- let previous = config.register_lints.take();
let clippy_args_var = self.clippy_args_var.take();
- config.register_lints = Some(Box::new(move |sess, lint_store| {
- if let Some(ref previous) = previous {
- (previous)(sess, lint_store);
- }
-
- track_clippy_args(sess, &clippy_args_var);
+ config.parse_sess_created = Some(Box::new(move |parse_sess| {
+ track_clippy_args(parse_sess, &clippy_args_var);
}));
}
}
fn config(&mut self, config: &mut interface::Config) {
let previous = config.register_lints.take();
let clippy_args_var = self.clippy_args_var.take();
- config.register_lints = Some(Box::new(move |sess, mut lint_store| {
+ config.parse_sess_created = Some(Box::new(move |parse_sess| {
+ track_clippy_args(parse_sess, &clippy_args_var);
+ }));
+ config.register_lints = Some(Box::new(move |sess, lint_store| {
// technically we're ~guaranteed that this is none but might as well call anything that
// is there already. Certainly it can't hurt.
if let Some(previous) = &previous {
(previous)(sess, lint_store);
}
- track_clippy_args(sess, &clippy_args_var);
-
- let conf = clippy_lints::read_conf(&[], &sess);
- clippy_lints::register_plugins(&mut lint_store, &sess, &conf);
- clippy_lints::register_pre_expansion_lints(&mut lint_store);
- clippy_lints::register_renamed(&mut lint_store);
+ let conf = clippy_lints::read_conf(sess);
+ clippy_lints::register_plugins(lint_store, sess, &conf);
+ clippy_lints::register_pre_expansion_lints(lint_store);
+ clippy_lints::register_renamed(lint_store);
}));
// FIXME: #4825; This is required, because Clippy lints that are based on MIR have to be
];
for note in &xs {
- handler.note_without_error(¬e);
+ handler.note_without_error(note);
}
// If backtraces are enabled, also print the query stack