File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -546,7 +546,9 @@ impl<'hir> Map<'hir> {
546
546
let def_kind = self . tcx . def_kind ( def_id) ;
547
547
match def_kind {
548
548
DefKind :: Trait | DefKind :: TraitAlias => def_id,
549
- DefKind :: TyParam | DefKind :: ConstParam => self . tcx . local_parent ( def_id) ,
549
+ DefKind :: TyParam | DefKind :: ConstParam | DefKind :: LifetimeParam => {
550
+ self . tcx . local_parent ( def_id)
551
+ }
550
552
_ => bug ! ( "ty_param_owner: {:?} is a {:?} not a type parameter" , def_id, def_kind) ,
551
553
}
552
554
}
@@ -555,7 +557,9 @@ impl<'hir> Map<'hir> {
555
557
let def_kind = self . tcx . def_kind ( def_id) ;
556
558
match def_kind {
557
559
DefKind :: Trait | DefKind :: TraitAlias => kw:: SelfUpper ,
558
- DefKind :: TyParam | DefKind :: ConstParam => self . tcx . item_name ( def_id. to_def_id ( ) ) ,
560
+ DefKind :: TyParam | DefKind :: ConstParam | DefKind :: LifetimeParam => {
561
+ self . tcx . item_name ( def_id. to_def_id ( ) )
562
+ }
559
563
_ => bug ! ( "ty_param_name: {:?} is a {:?} not a type parameter" , def_id, def_kind) ,
560
564
}
561
565
}
Original file line number Diff line number Diff line change @@ -251,9 +251,12 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
251
251
tcx. mk_region ( ty:: ReLateBound ( debruijn, br) )
252
252
}
253
253
254
- rl:: Region :: EarlyBound ( index, id) => {
255
- let name = lifetime_name ( id. expect_local ( ) ) ;
256
- tcx. mk_region ( ty:: ReEarlyBound ( ty:: EarlyBoundRegion { def_id : id, index, name } ) )
254
+ rl:: Region :: EarlyBound ( _, def_id) => {
255
+ let name = tcx. hir ( ) . ty_param_name ( def_id. expect_local ( ) ) ;
256
+ let item_def_id = tcx. hir ( ) . ty_param_owner ( def_id. expect_local ( ) ) ;
257
+ let generics = tcx. generics_of ( item_def_id) ;
258
+ let index = generics. param_def_id_to_index [ & def_id] ;
259
+ tcx. mk_region ( ty:: ReEarlyBound ( ty:: EarlyBoundRegion { def_id, index, name } ) )
257
260
}
258
261
259
262
rl:: Region :: Free ( scope, id) => {
You can’t perform that action at this time.
0 commit comments