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> {
546546 let def_kind = self . tcx . def_kind ( def_id) ;
547547 match def_kind {
548548 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+ }
550552 _ => bug ! ( "ty_param_owner: {:?} is a {:?} not a type parameter" , def_id, def_kind) ,
551553 }
552554 }
@@ -555,7 +557,9 @@ impl<'hir> Map<'hir> {
555557 let def_kind = self . tcx . def_kind ( def_id) ;
556558 match def_kind {
557559 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+ }
559563 _ => bug ! ( "ty_param_name: {:?} is a {:?} not a type parameter" , def_id, def_kind) ,
560564 }
561565 }
Original file line number Diff line number Diff line change @@ -251,9 +251,12 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
251251 tcx. mk_region ( ty:: ReLateBound ( debruijn, br) )
252252 }
253253
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 } ) )
257260 }
258261
259262 rl:: Region :: Free ( scope, id) => {
You can’t perform that action at this time.
0 commit comments