File tree Expand file tree Collapse file tree 1 file changed +18
-12
lines changed
compiler/rustc_passes/src Expand file tree Collapse file tree 1 file changed +18
-12
lines changed Original file line number Diff line number Diff line change @@ -511,18 +511,24 @@ fn check_item<'tcx>(
511511 }
512512 }
513513 DefKind :: Impl => {
514- let item = tcx. hir ( ) . item ( id) ;
515- if let hir:: ItemKind :: Impl ( hir:: Impl { ref of_trait, items, .. } ) = item. kind {
516- if of_trait. is_some ( ) {
517- worklist. push ( item. def_id ) ;
518- }
519- for impl_item_ref in * items {
520- let impl_item = tcx. hir ( ) . impl_item ( impl_item_ref. id ) ;
521- if of_trait. is_some ( )
522- || has_allow_dead_code_or_lang_attr ( tcx, impl_item. hir_id ( ) )
523- {
524- worklist. push ( impl_item_ref. id . def_id ) ;
525- }
514+ let of_trait = tcx. impl_trait_ref ( id. def_id ) ;
515+
516+ if of_trait. is_some ( ) {
517+ worklist. push ( id. def_id ) ;
518+ }
519+
520+ // get DefIds from another query
521+ let local_def_ids = tcx
522+ . associated_item_def_ids ( id. def_id )
523+ . iter ( )
524+ . filter_map ( |def_id| def_id. as_local ( ) ) ;
525+
526+ // And we access the Map here to get HirId from LocalDefId
527+ for id in local_def_ids {
528+ if of_trait. is_some ( )
529+ || has_allow_dead_code_or_lang_attr ( tcx, tcx. hir ( ) . local_def_id_to_hir_id ( id) )
530+ {
531+ worklist. push ( id) ;
526532 }
527533 }
528534 }
You can’t perform that action at this time.
0 commit comments