@@ -482,13 +482,17 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
482
482
let current_owner = std:: mem:: replace ( & mut self . current_hir_id_owner , def_id) ;
483
483
let current_local_counter =
484
484
std:: mem:: replace ( & mut self . item_local_id_counter , hir:: ItemLocalId :: new ( 1 ) ) ;
485
+ let current_impl_trait_defs = std:: mem:: take ( & mut self . impl_trait_defs ) ;
486
+ let current_impl_trait_bounds = std:: mem:: take ( & mut self . impl_trait_bounds ) ;
485
487
486
488
// Always allocate the first `HirId` for the owner itself.
487
489
let _old = self . node_id_to_local_id . insert ( owner, hir:: ItemLocalId :: new ( 0 ) ) ;
488
490
debug_assert_eq ! ( _old, None ) ;
489
491
490
492
let item = f ( self ) ;
491
493
debug_assert_eq ! ( def_id, item. def_id( ) ) ;
494
+ debug_assert ! ( self . impl_trait_defs. is_empty( ) ) ;
495
+ debug_assert ! ( self . impl_trait_bounds. is_empty( ) ) ;
492
496
let info = self . make_owner_info ( item) ;
493
497
494
498
self . attrs = current_attrs;
@@ -498,6 +502,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
498
502
self . trait_map = current_trait_map;
499
503
self . current_hir_id_owner = current_owner;
500
504
self . item_local_id_counter = current_local_counter;
505
+ self . impl_trait_defs = current_impl_trait_defs;
506
+ self . impl_trait_bounds = current_impl_trait_bounds;
501
507
502
508
let _old = self . children . insert ( def_id, hir:: MaybeOwner :: Owner ( info) ) ;
503
509
debug_assert ! ( _old. is_none( ) )
0 commit comments