File tree 3 files changed +13
-3
lines changed
rustc_smir/src/rustc_smir/convert
src/tools/clippy/clippy_lints/src
3 files changed +13
-3
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,25 @@ fn check_fn_args<'cx, 'tcx: 'cx>(
460
460
}
461
461
None
462
462
} ) {
463
+ let binding_item = match lifetime. res {
464
+ LifetimeName :: Param ( param_def_id) => Some ( cx. tcx . parent ( param_def_id. to_def_id ( ) ) ) ,
465
+ _ => None ,
466
+ } ;
467
+
463
468
if !lifetime. is_anonymous ( )
464
469
&& fn_sig
465
470
. output ( )
466
471
. walk ( )
467
472
. filter_map ( |arg| {
468
473
arg. as_region ( ) . and_then ( |lifetime| match lifetime. kind ( ) {
469
- ty:: ReEarlyParam ( r) => Some ( r. def_id ) ,
474
+ ty:: ReEarlyParam ( r) if binding_item. is_some ( ) => Some (
475
+ cx. tcx . generics_of ( binding_item. unwrap ( ) ) . region_param ( r, cx. tcx ) . def_id
476
+ ) ,
477
+ // It doesn't seem entirely correct to return none here, since all early-bound
478
+ // parameters will have a corresponding `DefId`. It shouldn't matter though as if
479
+ // `binding_item` is `None` then the `any` afterwards is going to return `false`
480
+ // no matter what `DefId`'s we do or do not return.
481
+ ty:: ReEarlyParam ( _) => None ,
470
482
ty:: ReBound ( _, r) => r. kind . get_id ( ) ,
471
483
ty:: ReLateParam ( r) => r. bound_region . get_id ( ) ,
472
484
ty:: ReStatic
You can’t perform that action at this time.
0 commit comments