@@ -759,6 +759,15 @@ fn maybe_record_as_seed<'tcx>(
759
759
match tcx. def_kind ( parent) {
760
760
DefKind :: Impl { of_trait : false } | DefKind :: Trait => { }
761
761
DefKind :: Impl { of_trait : true } => {
762
+ if let Some ( trait_item_def_id) =
763
+ tcx. associated_item ( owner_id. def_id ) . trait_item_def_id
764
+ && let Some ( trait_item_local_def_id) = trait_item_def_id. as_local ( )
765
+ && let Some ( comes_from_allow) =
766
+ has_allow_dead_code_or_lang_attr ( tcx, trait_item_local_def_id)
767
+ {
768
+ worklist. push ( ( owner_id. def_id , comes_from_allow) ) ;
769
+ }
770
+
762
771
// We only care about associated items of traits,
763
772
// because they cannot be visited directly,
764
773
// so we later mark them as live if their corresponding traits
@@ -772,6 +781,15 @@ fn maybe_record_as_seed<'tcx>(
772
781
}
773
782
DefKind :: Impl { of_trait : true } => {
774
783
if allow_dead_code. is_none ( ) {
784
+ if let Some ( trait_def_id) = tcx
785
+ . impl_trait_ref ( owner_id. def_id )
786
+ . and_then ( |trait_ref| trait_ref. skip_binder ( ) . def_id . as_local ( ) )
787
+ && let Some ( comes_from_allow) =
788
+ has_allow_dead_code_or_lang_attr ( tcx, trait_def_id)
789
+ {
790
+ worklist. push ( ( owner_id. def_id , comes_from_allow) ) ;
791
+ }
792
+
775
793
unsolved_items. push ( owner_id. def_id ) ;
776
794
}
777
795
}
0 commit comments