Move lint_store from GlobalCtxt to Session.
This was made possible by the removal of plugin support, which simplified lint store creation. This simplifies the places in rustc and rustdoc that call `describe_lints`, which are early on. The lint store is now built before those places, so they don't have to create their own lint store for temporary use, they can just use the main one.
This commit is contained in:
@@ -485,6 +485,16 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se
|
||||
sess.opts.untracked_state_hash = hasher.finish()
|
||||
}
|
||||
|
||||
// Even though the session holds the lint store, we can't build the
|
||||
// lint store until after the session exists. And we wait until now
|
||||
// so that `register_lints` sees the fully initialized session.
|
||||
let mut lint_store = rustc_lint::new_lint_store(sess.enable_internal_lints());
|
||||
if let Some(register_lints) = config.register_lints.as_deref() {
|
||||
register_lints(&sess, &mut lint_store);
|
||||
sess.registered_lints = true;
|
||||
}
|
||||
sess.lint_store = Some(Lrc::new(lint_store));
|
||||
|
||||
let compiler = Compiler {
|
||||
sess: Lrc::new(sess),
|
||||
codegen_backend: Lrc::from(codegen_backend),
|
||||
|
||||
Reference in New Issue
Block a user