diff options
| author | Santiago Pastorino <spastorino@gmail.com> | 2022-05-31 11:48:12 -0300 |
|---|---|---|
| committer | Santiago Pastorino <spastorino@gmail.com> | 2022-05-31 14:53:32 -0300 |
| commit | 1a71103c93424da73d893d53dec2a30e3b2af2cd (patch) | |
| tree | ae54c7937261e5ec84d31e876628a2616ad95365 | |
| parent | 3d6eae8cd2134f1db0b4cbd13ce702acba6f36c4 (diff) | |
| download | rust-1a71103c93424da73d893d53dec2a30e3b2af2cd.tar.gz rust-1a71103c93424da73d893d53dec2a30e3b2af2cd.zip | |
Take and restore fields in with_hir_id_owner calls
| -rw-r--r-- | compiler/rustc_ast_lowering/src/lib.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index fb846249103..872c9f53fc0 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -482,6 +482,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { let current_owner = std::mem::replace(&mut self.current_hir_id_owner, def_id); let current_local_counter = std::mem::replace(&mut self.item_local_id_counter, hir::ItemLocalId::new(1)); + let current_impl_trait_defs = std::mem::take(&mut self.impl_trait_defs); + let current_impl_trait_bounds = std::mem::take(&mut self.impl_trait_bounds); // Always allocate the first `HirId` for the owner itself. let _old = self.node_id_to_local_id.insert(owner, hir::ItemLocalId::new(0)); @@ -489,6 +491,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { let item = f(self); debug_assert_eq!(def_id, item.def_id()); + debug_assert!(self.impl_trait_defs.is_empty()); + debug_assert!(self.impl_trait_bounds.is_empty()); let info = self.make_owner_info(item); self.attrs = current_attrs; @@ -498,6 +502,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { self.trait_map = current_trait_map; self.current_hir_id_owner = current_owner; self.item_local_id_counter = current_local_counter; + self.impl_trait_defs = current_impl_trait_defs; + self.impl_trait_bounds = current_impl_trait_bounds; let _old = self.children.insert(def_id, hir::MaybeOwner::Owner(info)); debug_assert!(_old.is_none()) |
