Skip to content

Commit 63c3aab

Browse files
committed
Create lifetime parameter like any other parameter.
1 parent 99e2d33 commit 63c3aab

File tree

1 file changed

+6
-3
lines changed
  • compiler/rustc_typeck/src/astconv

1 file changed

+6
-3
lines changed

compiler/rustc_typeck/src/astconv/mod.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,12 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
221221
tcx.mk_region(ty::ReLateBound(debruijn, br))
222222
}
223223

224-
Some(rl::Region::EarlyBound(index, id)) => {
225-
let name = lifetime_name(id.expect_local());
226-
tcx.mk_region(ty::ReEarlyBound(ty::EarlyBoundRegion { def_id: id, index, name }))
224+
Some(rl::Region::EarlyBound(_, def_id)) => {
225+
let name = tcx.hir().ty_param_name(def_id.expect_local());
226+
let item_def_id = tcx.hir().ty_param_owner(def_id.expect_local());
227+
let generics = tcx.generics_of(item_def_id);
228+
let index = generics.param_def_id_to_index[&def_id];
229+
tcx.mk_region(ty::ReEarlyBound(ty::EarlyBoundRegion { def_id, index, name }))
227230
}
228231

229232
Some(rl::Region::Free(scope, id)) => {

0 commit comments

Comments
 (0)