@@ -126,7 +126,7 @@ struct LoweringContext<'a, 'hir> {
126126 is_in_trait_impl : bool ,
127127 is_in_dyn_type : bool ,
128128
129- current_hir_id_owner : LocalDefId ,
129+ current_hir_id_owner : hir :: OwnerId ,
130130 item_local_id_counter : hir:: ItemLocalId ,
131131 local_id_to_def_id : SortedMap < ItemLocalId , LocalDefId > ,
132132 trait_map : FxHashMap < ItemLocalId , Box < [ TraitCandidate ] > > ,
@@ -572,7 +572,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
572572 let current_node_ids = std:: mem:: take ( & mut self . node_id_to_local_id ) ;
573573 let current_id_to_def_id = std:: mem:: take ( & mut self . local_id_to_def_id ) ;
574574 let current_trait_map = std:: mem:: take ( & mut self . trait_map ) ;
575- let current_owner = std:: mem:: replace ( & mut self . current_hir_id_owner , def_id) ;
575+ let current_owner =
576+ std:: mem:: replace ( & mut self . current_hir_id_owner , hir:: OwnerId { def_id } ) ;
576577 let current_local_counter =
577578 std:: mem:: replace ( & mut self . item_local_id_counter , hir:: ItemLocalId :: new ( 1 ) ) ;
578579 let current_impl_trait_defs = std:: mem:: take ( & mut self . impl_trait_defs ) ;
@@ -587,7 +588,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
587588 debug_assert_eq ! ( _old, None ) ;
588589
589590 let item = f ( self ) ;
590- debug_assert_eq ! ( def_id, item. def_id( ) ) ;
591+ debug_assert_eq ! ( def_id, item. def_id( ) . def_id ) ;
591592 // `f` should have consumed all the elements in these vectors when constructing `item`.
592593 debug_assert ! ( self . impl_trait_defs. is_empty( ) ) ;
593594 debug_assert ! ( self . impl_trait_bounds. is_empty( ) ) ;
@@ -786,7 +787,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
786787 /// Mark a span as relative to the current owning item.
787788 fn lower_span ( & self , span : Span ) -> Span {
788789 if self . tcx . sess . opts . unstable_opts . incremental_relative_spans {
789- span. with_parent ( Some ( self . current_hir_id_owner ) )
790+ span. with_parent ( Some ( self . current_hir_id_owner . def_id ) )
790791 } else {
791792 // Do not make spans relative when not using incremental compilation.
792793 span
@@ -812,7 +813,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
812813 LifetimeRes :: Fresh { param, .. } => {
813814 // Late resolution delegates to us the creation of the `LocalDefId`.
814815 let _def_id = self . create_def (
815- self . current_hir_id_owner ,
816+ self . current_hir_id_owner . def_id ,
816817 param,
817818 DefPathData :: LifetimeNs ( kw:: UnderscoreLifetime ) ,
818819 ) ;
@@ -1062,7 +1063,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
10621063
10631064 let parent_def_id = self . current_hir_id_owner ;
10641065 let impl_trait_node_id = self . next_node_id ( ) ;
1065- self . create_def ( parent_def_id, impl_trait_node_id, DefPathData :: ImplTrait ) ;
1066+ self . create_def (
1067+ parent_def_id. def_id ,
1068+ impl_trait_node_id,
1069+ DefPathData :: ImplTrait ,
1070+ ) ;
10661071
10671072 self . with_dyn_type_scope ( false , |this| {
10681073 let node_id = this. next_node_id ( ) ;
@@ -1154,7 +1159,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
11541159 let node_id = self . next_node_id ( ) ;
11551160
11561161 // Add a definition for the in-band const def.
1157- self . create_def ( parent_def_id, node_id, DefPathData :: AnonConst ) ;
1162+ self . create_def (
1163+ parent_def_id. def_id ,
1164+ node_id,
1165+ DefPathData :: AnonConst ,
1166+ ) ;
11581167
11591168 let span = self . lower_span ( ty. span ) ;
11601169 let path_expr = Expr {
@@ -1551,7 +1560,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
15511560 debug ! ( ?lifetimes) ;
15521561
15531562 // `impl Trait` now just becomes `Foo<'a, 'b, ..>`.
1554- hir:: TyKind :: OpaqueDef ( hir:: ItemId { def_id : opaque_ty_def_id } , lifetimes, in_trait)
1563+ hir:: TyKind :: OpaqueDef (
1564+ hir:: ItemId { def_id : hir:: OwnerId { def_id : opaque_ty_def_id } } ,
1565+ lifetimes,
1566+ in_trait,
1567+ )
15551568 }
15561569
15571570 /// Registers a new opaque type with the proper `NodeId`s and
@@ -1567,7 +1580,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
15671580 // Generate an `type Foo = impl Trait;` declaration.
15681581 trace ! ( "registering opaque type with id {:#?}" , opaque_ty_id) ;
15691582 let opaque_ty_item = hir:: Item {
1570- def_id : opaque_ty_id,
1583+ def_id : hir :: OwnerId { def_id : opaque_ty_id } ,
15711584 ident : Ident :: empty ( ) ,
15721585 kind : opaque_ty_item_kind,
15731586 vis_span : self . lower_span ( span. shrink_to_lo ( ) ) ,
@@ -2018,7 +2031,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
20182031 // async fn, so the *type parameters* are inherited. It's
20192032 // only the lifetime parameters that we must supply.
20202033 let opaque_ty_ref = hir:: TyKind :: OpaqueDef (
2021- hir:: ItemId { def_id : opaque_ty_def_id } ,
2034+ hir:: ItemId { def_id : hir :: OwnerId { def_id : opaque_ty_def_id } } ,
20222035 generic_args,
20232036 in_trait,
20242037 ) ;
0 commit comments