@@ -1233,6 +1233,7 @@ pub(super) fn hir_module_items(tcx: TyCtxt<'_>, module_id: LocalModDefId) -> Mod
12331233        body_owners :  body_owners. into_boxed_slice ( ) , 
12341234        opaques :  opaques. into_boxed_slice ( ) , 
12351235        nested_bodies :  nested_bodies. into_boxed_slice ( ) , 
1236+         delayed_lint_items :  Box :: new ( [ ] ) , 
12361237    } 
12371238} 
12381239
@@ -1254,6 +1255,7 @@ pub(crate) fn hir_crate_items(tcx: TyCtxt<'_>, _: ()) -> ModuleItems {
12541255        body_owners, 
12551256        opaques, 
12561257        nested_bodies, 
1258+         delayed_lint_items, 
12571259        ..
12581260    }  = collector; 
12591261
@@ -1266,6 +1268,7 @@ pub(crate) fn hir_crate_items(tcx: TyCtxt<'_>, _: ()) -> ModuleItems {
12661268        body_owners :  body_owners. into_boxed_slice ( ) , 
12671269        opaques :  opaques. into_boxed_slice ( ) , 
12681270        nested_bodies :  nested_bodies. into_boxed_slice ( ) , 
1271+         delayed_lint_items :  delayed_lint_items. into_boxed_slice ( ) , 
12691272    } 
12701273} 
12711274
@@ -1282,6 +1285,7 @@ struct ItemCollector<'tcx> {
12821285    body_owners :  Vec < LocalDefId > , 
12831286    opaques :  Vec < LocalDefId > , 
12841287    nested_bodies :  Vec < LocalDefId > , 
1288+     delayed_lint_items :  Vec < OwnerId > , 
12851289} 
12861290
12871291impl < ' tcx >  ItemCollector < ' tcx >  { 
@@ -1297,6 +1301,7 @@ impl<'tcx> ItemCollector<'tcx> {
12971301            body_owners :  Vec :: default ( ) , 
12981302            opaques :  Vec :: default ( ) , 
12991303            nested_bodies :  Vec :: default ( ) , 
1304+             delayed_lint_items :  Vec :: default ( ) , 
13001305        } 
13011306    } 
13021307} 
@@ -1314,6 +1319,9 @@ impl<'hir> Visitor<'hir> for ItemCollector<'hir> {
13141319        } 
13151320
13161321        self . items . push ( item. item_id ( ) ) ; 
1322+         if  self . crate_collector  && item. has_delayed_lints  { 
1323+             self . delayed_lint_items . push ( item. item_id ( ) . owner_id ) ; 
1324+         } 
13171325
13181326        // Items that are modules are handled here instead of in visit_mod. 
13191327        if  let  ItemKind :: Mod ( _,  module)  = & item. kind  { 
@@ -1329,6 +1337,9 @@ impl<'hir> Visitor<'hir> for ItemCollector<'hir> {
13291337
13301338    fn  visit_foreign_item ( & mut  self ,  item :  & ' hir  ForeignItem < ' hir > )  { 
13311339        self . foreign_items . push ( item. foreign_item_id ( ) ) ; 
1340+         if  self . crate_collector  && item. has_delayed_lints  { 
1341+             self . delayed_lint_items . push ( item. foreign_item_id ( ) . owner_id ) ; 
1342+         } 
13321343        intravisit:: walk_foreign_item ( self ,  item) 
13331344    } 
13341345
@@ -1362,6 +1373,10 @@ impl<'hir> Visitor<'hir> for ItemCollector<'hir> {
13621373        } 
13631374
13641375        self . trait_items . push ( item. trait_item_id ( ) ) ; 
1376+         if  self . crate_collector  && item. has_delayed_lints  { 
1377+             self . delayed_lint_items . push ( item. trait_item_id ( ) . owner_id ) ; 
1378+         } 
1379+ 
13651380        intravisit:: walk_trait_item ( self ,  item) 
13661381    } 
13671382
@@ -1371,6 +1386,10 @@ impl<'hir> Visitor<'hir> for ItemCollector<'hir> {
13711386        } 
13721387
13731388        self . impl_items . push ( item. impl_item_id ( ) ) ; 
1389+         if  self . crate_collector  && item. has_delayed_lints  { 
1390+             self . delayed_lint_items . push ( item. impl_item_id ( ) . owner_id ) ; 
1391+         } 
1392+ 
13741393        intravisit:: walk_impl_item ( self ,  item) 
13751394    } 
13761395} 
0 commit comments