From 552f6b0f81c7e2ad031695482d69776439a7935c Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Tue, 2 Aug 2022 15:27:52 -0300 Subject: [PATCH] No need to check binders to ignore on new_named_lifetime_with_res's LifetimeRes::Fresh --- compiler/rustc_ast_lowering/src/lib.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 0ee2ffd271e..43593018814 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -1919,18 +1919,13 @@ fn new_named_lifetime_with_res( hir::LifetimeName::Param(param, p_name) } - LifetimeRes::Fresh { param, binder } => { + LifetimeRes::Fresh { param, .. } => { debug_assert_eq!(ident.name, kw::UnderscoreLifetime); let mut param = self.local_def_id(param); if let Some(mut captured_lifetimes) = self.captured_lifetimes.take() { - if !captured_lifetimes.binders_to_ignore.contains(&binder) { - match captured_lifetimes.captures.entry(param) { - Entry::Occupied(o) => param = self.local_def_id(o.get().1), - Entry::Vacant(_) => { - panic!("Lifetime {:?} should have a def_id at this point", id); - } - } + if let Entry::Occupied(o) = captured_lifetimes.captures.entry(param) { + param = self.local_def_id(o.get().1); } self.captured_lifetimes = Some(captured_lifetimes);