@@ -126,7 +126,7 @@ struct LoweringContext<'a, 'hir> {
126
126
is_in_trait_impl : bool ,
127
127
is_in_dyn_type : bool ,
128
128
129
- current_hir_id_owner : LocalDefId ,
129
+ current_hir_id_owner : hir :: OwnerId ,
130
130
item_local_id_counter : hir:: ItemLocalId ,
131
131
local_id_to_def_id : SortedMap < ItemLocalId , LocalDefId > ,
132
132
trait_map : FxHashMap < ItemLocalId , Box < [ TraitCandidate ] > > ,
@@ -572,7 +572,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
572
572
let current_node_ids = std:: mem:: take ( & mut self . node_id_to_local_id ) ;
573
573
let current_id_to_def_id = std:: mem:: take ( & mut self . local_id_to_def_id ) ;
574
574
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 } ) ;
576
577
let current_local_counter =
577
578
std:: mem:: replace ( & mut self . item_local_id_counter , hir:: ItemLocalId :: new ( 1 ) ) ;
578
579
let current_impl_trait_defs = std:: mem:: take ( & mut self . impl_trait_defs ) ;
@@ -587,7 +588,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
587
588
debug_assert_eq ! ( _old, None ) ;
588
589
589
590
let item = f ( self ) ;
590
- debug_assert_eq ! ( def_id, item. def_id( ) ) ;
591
+ debug_assert_eq ! ( def_id, item. def_id( ) . def_id ) ;
591
592
// `f` should have consumed all the elements in these vectors when constructing `item`.
592
593
debug_assert ! ( self . impl_trait_defs. is_empty( ) ) ;
593
594
debug_assert ! ( self . impl_trait_bounds. is_empty( ) ) ;
@@ -786,7 +787,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
786
787
/// Mark a span as relative to the current owning item.
787
788
fn lower_span ( & self , span : Span ) -> Span {
788
789
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 ) )
790
791
} else {
791
792
// Do not make spans relative when not using incremental compilation.
792
793
span
@@ -812,7 +813,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
812
813
LifetimeRes :: Fresh { param, .. } => {
813
814
// Late resolution delegates to us the creation of the `LocalDefId`.
814
815
let _def_id = self . create_def (
815
- self . current_hir_id_owner ,
816
+ self . current_hir_id_owner . def_id ,
816
817
param,
817
818
DefPathData :: LifetimeNs ( kw:: UnderscoreLifetime ) ,
818
819
) ;
@@ -1062,7 +1063,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1062
1063
1063
1064
let parent_def_id = self . current_hir_id_owner ;
1064
1065
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
+ ) ;
1066
1071
1067
1072
self . with_dyn_type_scope ( false , |this| {
1068
1073
let node_id = this. next_node_id ( ) ;
@@ -1154,7 +1159,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1154
1159
let node_id = self . next_node_id ( ) ;
1155
1160
1156
1161
// 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
+ ) ;
1158
1167
1159
1168
let span = self . lower_span ( ty. span ) ;
1160
1169
let path_expr = Expr {
@@ -1551,7 +1560,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1551
1560
debug ! ( ?lifetimes) ;
1552
1561
1553
1562
// `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
+ )
1555
1568
}
1556
1569
1557
1570
/// Registers a new opaque type with the proper `NodeId`s and
@@ -1567,7 +1580,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1567
1580
// Generate an `type Foo = impl Trait;` declaration.
1568
1581
trace ! ( "registering opaque type with id {:#?}" , opaque_ty_id) ;
1569
1582
let opaque_ty_item = hir:: Item {
1570
- def_id : opaque_ty_id,
1583
+ def_id : hir :: OwnerId { def_id : opaque_ty_id } ,
1571
1584
ident : Ident :: empty ( ) ,
1572
1585
kind : opaque_ty_item_kind,
1573
1586
vis_span : self . lower_span ( span. shrink_to_lo ( ) ) ,
@@ -2018,7 +2031,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
2018
2031
// async fn, so the *type parameters* are inherited. It's
2019
2032
// only the lifetime parameters that we must supply.
2020
2033
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 } } ,
2022
2035
generic_args,
2023
2036
in_trait,
2024
2037
) ;
0 commit comments