@@ -54,8 +54,8 @@ use rustc_hir::def_id::{CRATE_DEF_ID, LOCAL_CRATE, LocalDefId};
5454use rustc_hir:: definitions:: { DefPathData , DisambiguatorState } ;
5555use rustc_hir:: lints:: { AttributeLint , DelayedLint } ;
5656use rustc_hir:: {
57- self as hir, AngleBrackets , ConstArg , GenericArg , HirId , ItemLocalMap , LifetimeSource ,
58- LifetimeSyntax , ParamName , Target , TraitCandidate , find_attr,
57+ self as hir, AngleBrackets , ConstArg , DelayedOwner , GenericArg , HirId , ItemLocalMap ,
58+ LifetimeSource , LifetimeSyntax , ParamName , Target , TraitCandidate , find_attr,
5959} ;
6060use rustc_index:: { Idx , IndexSlice , IndexVec } ;
6161use rustc_macros:: extension;
@@ -634,25 +634,31 @@ pub fn lower_to_hir(tcx: TyCtxt<'_>, (): ()) -> mid_hir::Crate<'_> {
634634 let mut delayed_ids: FxIndexSet < LocalDefId > = Default :: default ( ) ;
635635
636636 for def_id in ast_index. indices ( ) {
637- let kind = match & ast_index[ def_id] {
638- AstOwner :: Item ( Item { kind : ItemKind :: Delegation { .. } , .. } ) => {
639- Some ( hir:: DelayedOwnerKind :: Item )
640- }
641- AstOwner :: AssocItem ( Item { kind : AssocItemKind :: Delegation { .. } , .. } , ctx) => {
642- match ctx {
643- AssocCtxt :: Trait => Some ( hir:: DelayedOwnerKind :: TraitItem ) ,
644- AssocCtxt :: Impl { .. } => Some ( hir:: DelayedOwnerKind :: ImplItem ) ,
645- }
637+ let delayed_owner = match & ast_index[ def_id] {
638+ AstOwner :: Item ( Item {
639+ kind : ItemKind :: Delegation ( box Delegation { ident, .. } ) ,
640+ ..
641+ } ) => Some ( DelayedOwner { kind : hir:: DelayedOwnerKind :: Item , ident : Some ( * ident) } ) ,
642+ AstOwner :: AssocItem (
643+ Item { kind : AssocItemKind :: Delegation ( box Delegation { ident, .. } ) , .. } ,
644+ ctx,
645+ ) => {
646+ let kind = match ctx {
647+ AssocCtxt :: Trait => hir:: DelayedOwnerKind :: TraitItem ,
648+ AssocCtxt :: Impl { .. } => hir:: DelayedOwnerKind :: ImplItem ,
649+ } ;
650+
651+ Some ( DelayedOwner { kind, ident : Some ( * ident) } )
646652 }
647653 _ => None ,
648654 } ;
649655
650- if let Some ( kind ) = kind {
656+ if let Some ( delayed_owner ) = delayed_owner {
651657 delayed_ids. insert ( def_id) ;
652658
653659 let owner = lowerer. owners . get_or_insert_mut ( def_id) ;
654660 if let hir:: MaybeOwner :: Phantom = owner {
655- * owner = hir:: MaybeOwner :: Delayed ( kind )
661+ * owner = hir:: MaybeOwner :: Delayed ( delayed_owner )
656662 }
657663 } else {
658664 lowerer. lower_node ( def_id) ;
0 commit comments