@@ -117,6 +117,7 @@ declare_box_region_type!(
117117/// Returns `None` if we're aborting after handling -W help.
118118pub fn configure_and_expand (
119119 sess : Lrc < Session > ,
120+ lint_store : Lrc < lint:: LintStore > ,
120121 cstore : Lrc < CStore > ,
121122 krate : ast:: Crate ,
122123 crate_name : & str ,
@@ -134,6 +135,7 @@ pub fn configure_and_expand(
134135 let resolver_arenas = Resolver :: arenas ( ) ;
135136 let res = configure_and_expand_inner (
136137 sess,
138+ & lint_store,
137139 & * cstore,
138140 krate,
139141 & crate_name,
@@ -227,7 +229,7 @@ pub fn register_plugins<'a>(
227229 cstore : & ' a CStore ,
228230 mut krate : ast:: Crate ,
229231 crate_name : & str ,
230- ) -> Result < ( ast:: Crate , PluginInfo ) > {
232+ ) -> Result < ( ast:: Crate , PluginInfo , Lrc < lint :: LintStore > ) > {
231233 krate = time ( sess, "attributes injection" , || {
232234 syntax_ext:: cmdline_attrs:: inject (
233235 krate, & sess. parse_sess , & sess. opts . debugging_opts . crate_attr
@@ -278,7 +280,12 @@ pub fn register_plugins<'a>(
278280 )
279281 } ) ;
280282
281- let mut registry = Registry :: new ( sess, krate. span ) ;
283+ let mut lint_store = rustc_lint:: new_lint_store (
284+ sess. opts . debugging_opts . no_interleave_lints ,
285+ sess. unstable_options ( ) ,
286+ ) ;
287+
288+ let mut registry = Registry :: new ( sess, & mut lint_store, krate. span ) ;
282289
283290 time ( sess, "plugin registration" , || {
284291 for registrar in registrars {
@@ -289,36 +296,20 @@ pub fn register_plugins<'a>(
289296
290297 let Registry {
291298 syntax_exts,
292- early_lint_passes,
293- late_lint_passes,
294- lints,
295- lint_groups,
296299 llvm_passes,
297300 attributes,
298301 ..
299302 } = registry;
300303
301- let mut ls = sess. lint_store . borrow_mut ( ) ;
302- ls. register_lints ( & lints) ;
303- for pass in early_lint_passes {
304- ls. register_early_pass ( pass) ;
305- }
306- for pass in late_lint_passes {
307- ls. register_late_pass ( pass) ;
308- }
309-
310- for ( name, ( to, deprecated_name) ) in lint_groups {
311- ls. register_group ( true , name, deprecated_name, to) ;
312- }
313-
314304 * sess. plugin_llvm_passes . borrow_mut ( ) = llvm_passes;
315305 * sess. plugin_attributes . borrow_mut ( ) = attributes;
316306
317- Ok ( ( krate, PluginInfo { syntax_exts } ) )
307+ Ok ( ( krate, PluginInfo { syntax_exts } , Lrc :: new ( lint_store ) ) )
318308}
319309
320310fn configure_and_expand_inner < ' a > (
321311 sess : & ' a Session ,
312+ lint_store : & ' a lint:: LintStore ,
322313 cstore : & ' a CStore ,
323314 mut krate : ast:: Crate ,
324315 crate_name : & str ,
@@ -329,7 +320,7 @@ fn configure_and_expand_inner<'a>(
329320 time ( sess, "pre-AST-expansion lint checks" , || {
330321 lint:: check_ast_crate (
331322 sess,
332- & * sess . lint_store . borrow ( ) ,
323+ lint_store,
333324 & krate,
334325 true ,
335326 rustc_lint:: BuiltinCombinedPreExpansionLintPass :: new ( ) ) ;
@@ -539,6 +530,7 @@ fn configure_and_expand_inner<'a>(
539530
540531pub fn lower_to_hir (
541532 sess : & Session ,
533+ lint_store : & lint:: LintStore ,
542534 cstore : & CStore ,
543535 resolver : & mut Resolver < ' _ > ,
544536 dep_graph : & DepGraph ,
@@ -559,7 +551,7 @@ pub fn lower_to_hir(
559551 time ( sess, "early lint checks" , || {
560552 lint:: check_ast_crate (
561553 sess,
562- & * sess . lint_store . borrow ( ) ,
554+ lint_store,
563555 & krate,
564556 false ,
565557 rustc_lint:: BuiltinCombinedEarlyLintPass :: new ( ) ,
@@ -826,6 +818,7 @@ impl BoxedGlobalCtxt {
826818
827819pub fn create_global_ctxt (
828820 compiler : & Compiler ,
821+ lint_store : Lrc < lint:: LintStore > ,
829822 mut hir_forest : hir:: map:: Forest ,
830823 defs : hir:: map:: Definitions ,
831824 resolutions : Resolutions ,
@@ -863,6 +856,7 @@ pub fn create_global_ctxt(
863856
864857 let gcx = TyCtxt :: create_global_ctxt (
865858 sess,
859+ lint_store,
866860 cstore,
867861 local_providers,
868862 extern_providers,
0 commit comments