@@ -135,7 +135,7 @@ pub fn relate_type_and_mut<'tcx, R: TypeRelation<'tcx>>(
135
135
}
136
136
137
137
#[ inline]
138
- pub fn relate_args < ' tcx , R : TypeRelation < ' tcx > > (
138
+ pub fn relate_args_invariantly < ' tcx , R : TypeRelation < ' tcx > > (
139
139
relation : & mut R ,
140
140
a_arg : GenericArgsRef < ' tcx > ,
141
141
b_arg : GenericArgsRef < ' tcx > ,
@@ -284,7 +284,7 @@ impl<'tcx> Relate<'tcx> for ty::AliasTy<'tcx> {
284
284
false , // do not fetch `type_of(a_def_id)`, as it will cause a cycle
285
285
) ?,
286
286
DefKind :: AssocTy | DefKind :: AssocConst | DefKind :: TyAlias => {
287
- relation . relate ( a. args , b. args ) ?
287
+ relate_args_invariantly ( relation , a. args , b. args ) ?
288
288
}
289
289
def => bug ! ( "unknown alias DefKind: {def:?}" ) ,
290
290
} ;
@@ -329,7 +329,7 @@ impl<'tcx> Relate<'tcx> for ty::TraitRef<'tcx> {
329
329
if a. def_id != b. def_id {
330
330
Err ( TypeError :: Traits ( expected_found ( relation, a. def_id , b. def_id ) ) )
331
331
} else {
332
- let args = relate_args ( relation, a. args , b. args ) ?;
332
+ let args = relate_args_invariantly ( relation, a. args , b. args ) ?;
333
333
Ok ( ty:: TraitRef :: new ( relation. tcx ( ) , a. def_id , args) )
334
334
}
335
335
}
@@ -345,7 +345,7 @@ impl<'tcx> Relate<'tcx> for ty::ExistentialTraitRef<'tcx> {
345
345
if a. def_id != b. def_id {
346
346
Err ( TypeError :: Traits ( expected_found ( relation, a. def_id , b. def_id ) ) )
347
347
} else {
348
- let args = relate_args ( relation, a. args , b. args ) ?;
348
+ let args = relate_args_invariantly ( relation, a. args , b. args ) ?;
349
349
Ok ( ty:: ExistentialTraitRef { def_id : a. def_id , args } )
350
350
}
351
351
}
@@ -463,7 +463,7 @@ pub fn structurally_relate_tys<'tcx, R: TypeRelation<'tcx>>(
463
463
// All Generator types with the same id represent
464
464
// the (anonymous) type of the same generator expression. So
465
465
// all of their regions should be equated.
466
- let args = relation . relate ( a_args, b_args) ?;
466
+ let args = relate_args_invariantly ( relation , a_args, b_args) ?;
467
467
Ok ( Ty :: new_generator ( tcx, a_id, args, movability) )
468
468
}
469
469
@@ -473,15 +473,15 @@ pub fn structurally_relate_tys<'tcx, R: TypeRelation<'tcx>>(
473
473
// All GeneratorWitness types with the same id represent
474
474
// the (anonymous) type of the same generator expression. So
475
475
// all of their regions should be equated.
476
- let args = relation . relate ( a_args, b_args) ?;
476
+ let args = relate_args_invariantly ( relation , a_args, b_args) ?;
477
477
Ok ( Ty :: new_generator_witness ( tcx, a_id, args) )
478
478
}
479
479
480
480
( & ty:: Closure ( a_id, a_args) , & ty:: Closure ( b_id, b_args) ) if a_id == b_id => {
481
481
// All Closure types with the same id represent
482
482
// the (anonymous) type of the same closure expression. So
483
483
// all of their regions should be equated.
484
- let args = relation . relate ( a_args, b_args) ?;
484
+ let args = relate_args_invariantly ( relation , a_args, b_args) ?;
485
485
Ok ( Ty :: new_closure ( tcx, a_id, & args) )
486
486
}
487
487
@@ -705,7 +705,7 @@ impl<'tcx> Relate<'tcx> for ty::ClosureArgs<'tcx> {
705
705
a : ty:: ClosureArgs < ' tcx > ,
706
706
b : ty:: ClosureArgs < ' tcx > ,
707
707
) -> RelateResult < ' tcx , ty:: ClosureArgs < ' tcx > > {
708
- let args = relate_args ( relation, a. args , b. args ) ?;
708
+ let args = relate_args_invariantly ( relation, a. args , b. args ) ?;
709
709
Ok ( ty:: ClosureArgs { args } )
710
710
}
711
711
}
@@ -716,7 +716,7 @@ impl<'tcx> Relate<'tcx> for ty::GeneratorArgs<'tcx> {
716
716
a : ty:: GeneratorArgs < ' tcx > ,
717
717
b : ty:: GeneratorArgs < ' tcx > ,
718
718
) -> RelateResult < ' tcx , ty:: GeneratorArgs < ' tcx > > {
719
- let args = relate_args ( relation, a. args , b. args ) ?;
719
+ let args = relate_args_invariantly ( relation, a. args , b. args ) ?;
720
720
Ok ( ty:: GeneratorArgs { args } )
721
721
}
722
722
}
@@ -727,7 +727,7 @@ impl<'tcx> Relate<'tcx> for GenericArgsRef<'tcx> {
727
727
a : GenericArgsRef < ' tcx > ,
728
728
b : GenericArgsRef < ' tcx > ,
729
729
) -> RelateResult < ' tcx , GenericArgsRef < ' tcx > > {
730
- relate_args ( relation, a, b)
730
+ relate_args_invariantly ( relation, a, b)
731
731
}
732
732
}
733
733
0 commit comments