about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSantiago Pastorino <spastorino@gmail.com>2022-08-02 15:27:52 -0300
committerSantiago Pastorino <spastorino@gmail.com>2022-08-04 11:26:56 -0300
commit552f6b0f81c7e2ad031695482d69776439a7935c (patch)
tree8536f32ca7f9808a0ce5cef8bbfa9380a60aa253
parent6041ed077556bf26bb429ba8bdff8708aff70d14 (diff)
downloadrust-552f6b0f81c7e2ad031695482d69776439a7935c.tar.gz
rust-552f6b0f81c7e2ad031695482d69776439a7935c.zip
No need to check binders to ignore on new_named_lifetime_with_res's LifetimeRes::Fresh
-rw-r--r--compiler/rustc_ast_lowering/src/lib.rs11
1 files 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 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
 
                 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);