3 files changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -771,7 +771,6 @@ impl<'tcx> Stable<'tcx> for ty::RegionKind<'tcx> {
771
771
use stable_mir:: ty:: { BoundRegion , EarlyParamRegion , RegionKind } ;
772
772
match self {
773
773
ty:: ReEarlyParam ( early_reg) => RegionKind :: ReEarlyParam ( EarlyParamRegion {
774
- def_id : tables. region_def ( todo ! ( ) ) ,
775
774
index : early_reg. index ,
776
775
name : early_reg. name . to_string ( ) ,
777
776
} ) ,
Original file line number Diff line number Diff line change @@ -190,7 +190,6 @@ pub(crate) type DebruijnIndex = u32;
190
190
191
191
#[ derive( Clone , Debug , Eq , PartialEq ) ]
192
192
pub struct EarlyParamRegion {
193
- pub def_id : RegionDef ,
194
193
pub index : u32 ,
195
194
pub name : Symbol ,
196
195
}
Original file line number Diff line number Diff line change @@ -460,13 +460,19 @@ fn check_fn_args<'cx, 'tcx: 'cx>(
460
460
}
461
461
None
462
462
} ) {
463
- if !lifetime. is_anonymous ( )
463
+ if let LifetimeName :: Param ( param_def_id) = lifetime. res
464
+ && !lifetime. is_anonymous ( )
464
465
&& fn_sig
465
466
. output ( )
466
467
. walk ( )
467
468
. filter_map ( |arg| {
468
469
arg. as_region ( ) . and_then ( |lifetime| match lifetime. kind ( ) {
469
- ty:: ReEarlyParam ( r) => Some ( r. def_id ) ,
470
+ ty:: ReEarlyParam ( r) => Some (
471
+ cx. tcx
472
+ . generics_of ( cx. tcx . parent ( param_def_id. to_def_id ( ) ) )
473
+ . region_param ( r, cx. tcx )
474
+ . def_id ,
475
+ ) ,
470
476
ty:: ReBound ( _, r) => r. kind . get_id ( ) ,
471
477
ty:: ReLateParam ( r) => r. bound_region . get_id ( ) ,
472
478
ty:: ReStatic
@@ -476,14 +482,7 @@ fn check_fn_args<'cx, 'tcx: 'cx>(
476
482
| ty:: ReError ( _) => None ,
477
483
} )
478
484
} )
479
- . any ( |def_id| {
480
- matches ! (
481
- lifetime. res,
482
- LifetimeName :: Param ( param_def_id) if def_id
483
- . as_local( )
484
- . is_some_and( |def_id| def_id == param_def_id) ,
485
- )
486
- } )
485
+ . any ( |def_id| def_id. as_local ( ) . is_some_and ( |def_id| def_id == param_def_id) )
487
486
{
488
487
// `&Cow<'a, T>` when the return type uses 'a is okay
489
488
return None ;
0 commit comments