about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2022-05-24 08:31:11 +0200
committerCamille GILLOT <gillot.camille@gmail.com>2022-08-03 18:42:04 +0200
commit63c3aabeb8fdde119384562341b2d3b201be54ed (patch)
tree98b73b4c61f18eaf417472cb903e58e66acc2132
parent99e2d33315afa0168e971d929667dde0158200e7 (diff)
downloadrust-63c3aabeb8fdde119384562341b2d3b201be54ed.tar.gz
rust-63c3aabeb8fdde119384562341b2d3b201be54ed.zip
Create lifetime parameter like any other parameter.
-rw-r--r--compiler/rustc_typeck/src/astconv/mod.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/rustc_typeck/src/astconv/mod.rs b/compiler/rustc_typeck/src/astconv/mod.rs
index ee184a09391..dd6831e44fd 100644
--- a/compiler/rustc_typeck/src/astconv/mod.rs
+++ b/compiler/rustc_typeck/src/astconv/mod.rs
@@ -221,9 +221,12 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
                 tcx.mk_region(ty::ReLateBound(debruijn, br))
             }
 
-            Some(rl::Region::EarlyBound(index, id)) => {
-                let name = lifetime_name(id.expect_local());
-                tcx.mk_region(ty::ReEarlyBound(ty::EarlyBoundRegion { def_id: id, index, name }))
+            Some(rl::Region::EarlyBound(_, def_id)) => {
+                let name = tcx.hir().ty_param_name(def_id.expect_local());
+                let item_def_id = tcx.hir().ty_param_owner(def_id.expect_local());
+                let generics = tcx.generics_of(item_def_id);
+                let index = generics.param_def_id_to_index[&def_id];
+                tcx.mk_region(ty::ReEarlyBound(ty::EarlyBoundRegion { def_id, index, name }))
             }
 
             Some(rl::Region::Free(scope, id)) => {