From 9f10f589a78b0ed864884b6ab108fbd081ce2a8d Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Thu, 4 Aug 2022 10:05:04 -0300 Subject: [PATCH] Move new_remapping inside with_hir_id_owner --- compiler/rustc_ast_lowering/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index a0e448506db..4a3e58b2f8e 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -1399,7 +1399,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { // Contains the new lifetime definitions created for the TAIT (if any). let mut collected_lifetimes = Vec::new(); - let mut new_remapping = FxHashMap::default(); // If this came from a TAIT (as opposed to a function that returns an RPIT), we only want // to capture the lifetimes that appear in the bounds. So visit the bounds to find out @@ -1415,6 +1414,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { debug!(?lifetimes_to_remap); self.with_hir_id_owner(opaque_ty_node_id, |lctx| { + let mut new_remapping = FxHashMap::default(); + // If this opaque type is only capturing a subset of the lifetimes (those that appear // in bounds), then create the new lifetime parameters required and create a mapping // from the old `'a` (on the function) to the new `'a` (on the opaque type).