@@ -396,24 +396,6 @@ impl<'v, 'k, 'tcx> ItemLikeVisitor<'v> for LifeSeeder<'k, 'tcx> {
396
396
}
397
397
}
398
398
}
399
- hir:: ItemKind :: Trait ( .., trait_item_refs) => {
400
- for trait_item_ref in trait_item_refs {
401
- let trait_item = self . krate . trait_item ( trait_item_ref. id ) ;
402
- match trait_item. kind {
403
- hir:: TraitItemKind :: Const ( _, Some ( _) )
404
- | hir:: TraitItemKind :: Fn ( _, hir:: TraitFn :: Provided ( _) ) => {
405
- if has_allow_dead_code_or_lang_attr (
406
- self . tcx ,
407
- trait_item. hir_id ,
408
- & trait_item. attrs ,
409
- ) {
410
- self . worklist . push ( trait_item. hir_id ) ;
411
- }
412
- }
413
- _ => { }
414
- }
415
- }
416
- }
417
399
hir:: ItemKind :: Impl { ref of_trait, items, .. } => {
418
400
if of_trait. is_some ( ) {
419
401
self . worklist . push ( item. hir_id ) ;
@@ -440,15 +422,37 @@ impl<'v, 'k, 'tcx> ItemLikeVisitor<'v> for LifeSeeder<'k, 'tcx> {
440
422
}
441
423
}
442
424
443
- fn visit_trait_item ( & mut self , _item : & hir:: TraitItem < ' _ > ) {
444
- // ignore: we are handling this in `visit_item` above
425
+ fn visit_trait_item ( & mut self , trait_item : & hir:: TraitItem < ' _ > ) {
426
+ match trait_item. kind {
427
+ hir:: TraitItemKind :: Const ( _, Some ( _) )
428
+ | hir:: TraitItemKind :: Fn ( _, hir:: TraitFn :: Provided ( _) ) => {
429
+ if has_allow_dead_code_or_lang_attr ( self . tcx , trait_item. hir_id , & trait_item. attrs )
430
+ {
431
+ self . worklist . push ( trait_item. hir_id ) ;
432
+ }
433
+ }
434
+ _ => { }
435
+ }
445
436
}
446
437
447
438
fn visit_impl_item ( & mut self , _item : & hir:: ImplItem < ' _ > ) {
448
439
// ignore: we are handling this in `visit_item` above
449
440
}
450
441
451
- fn visit_foreign_item ( & mut self , _item : & ' v hir:: ForeignItem < ' v > ) { }
442
+ fn visit_foreign_item ( & mut self , foreign_item : & hir:: ForeignItem < ' _ > ) {
443
+ match foreign_item. kind {
444
+ hir:: ForeignItemKind :: Static ( ..) | hir:: ForeignItemKind :: Fn ( ..) => {
445
+ if has_allow_dead_code_or_lang_attr (
446
+ self . tcx ,
447
+ foreign_item. hir_id ,
448
+ & foreign_item. attrs ,
449
+ ) {
450
+ self . worklist . push ( foreign_item. hir_id ) ;
451
+ }
452
+ }
453
+ _ => { }
454
+ }
455
+ }
452
456
}
453
457
454
458
fn create_and_seed_worklist < ' tcx > (
0 commit comments