@@ -1233,6 +1233,7 @@ pub(super) fn hir_module_items(tcx: TyCtxt<'_>, module_id: LocalModDefId) -> Mod
1233
1233
body_owners : body_owners. into_boxed_slice ( ) ,
1234
1234
opaques : opaques. into_boxed_slice ( ) ,
1235
1235
nested_bodies : nested_bodies. into_boxed_slice ( ) ,
1236
+ delayed_lint_items : Box :: new ( [ ] ) ,
1236
1237
}
1237
1238
}
1238
1239
@@ -1254,6 +1255,7 @@ pub(crate) fn hir_crate_items(tcx: TyCtxt<'_>, _: ()) -> ModuleItems {
1254
1255
body_owners,
1255
1256
opaques,
1256
1257
nested_bodies,
1258
+ delayed_lint_items,
1257
1259
..
1258
1260
} = collector;
1259
1261
@@ -1266,6 +1268,7 @@ pub(crate) fn hir_crate_items(tcx: TyCtxt<'_>, _: ()) -> ModuleItems {
1266
1268
body_owners : body_owners. into_boxed_slice ( ) ,
1267
1269
opaques : opaques. into_boxed_slice ( ) ,
1268
1270
nested_bodies : nested_bodies. into_boxed_slice ( ) ,
1271
+ delayed_lint_items : delayed_lint_items. into_boxed_slice ( ) ,
1269
1272
}
1270
1273
}
1271
1274
@@ -1282,6 +1285,7 @@ struct ItemCollector<'tcx> {
1282
1285
body_owners : Vec < LocalDefId > ,
1283
1286
opaques : Vec < LocalDefId > ,
1284
1287
nested_bodies : Vec < LocalDefId > ,
1288
+ delayed_lint_items : Vec < OwnerId > ,
1285
1289
}
1286
1290
1287
1291
impl < ' tcx > ItemCollector < ' tcx > {
@@ -1297,6 +1301,7 @@ impl<'tcx> ItemCollector<'tcx> {
1297
1301
body_owners : Vec :: default ( ) ,
1298
1302
opaques : Vec :: default ( ) ,
1299
1303
nested_bodies : Vec :: default ( ) ,
1304
+ delayed_lint_items : Vec :: default ( ) ,
1300
1305
}
1301
1306
}
1302
1307
}
@@ -1314,6 +1319,9 @@ impl<'hir> Visitor<'hir> for ItemCollector<'hir> {
1314
1319
}
1315
1320
1316
1321
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
+ }
1317
1325
1318
1326
// Items that are modules are handled here instead of in visit_mod.
1319
1327
if let ItemKind :: Mod ( _, module) = & item. kind {
@@ -1329,6 +1337,9 @@ impl<'hir> Visitor<'hir> for ItemCollector<'hir> {
1329
1337
1330
1338
fn visit_foreign_item ( & mut self , item : & ' hir ForeignItem < ' hir > ) {
1331
1339
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
+ }
1332
1343
intravisit:: walk_foreign_item ( self , item)
1333
1344
}
1334
1345
@@ -1362,6 +1373,10 @@ impl<'hir> Visitor<'hir> for ItemCollector<'hir> {
1362
1373
}
1363
1374
1364
1375
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
+
1365
1380
intravisit:: walk_trait_item ( self , item)
1366
1381
}
1367
1382
@@ -1371,6 +1386,10 @@ impl<'hir> Visitor<'hir> for ItemCollector<'hir> {
1371
1386
}
1372
1387
1373
1388
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
+
1374
1393
intravisit:: walk_impl_item ( self , item)
1375
1394
}
1376
1395
}
0 commit comments