@@ -135,7 +135,7 @@ pub fn relate_type_and_mut<'tcx, R: TypeRelation<'tcx>>(
135135}
136136
137137#[ inline]
138- pub fn relate_args < ' tcx , R : TypeRelation < ' tcx > > (
138+ pub fn relate_args_invariantly < ' tcx , R : TypeRelation < ' tcx > > (
139139 relation : & mut R ,
140140 a_arg : GenericArgsRef < ' tcx > ,
141141 b_arg : GenericArgsRef < ' tcx > ,
@@ -284,7 +284,7 @@ impl<'tcx> Relate<'tcx> for ty::AliasTy<'tcx> {
284284 false , // do not fetch `type_of(a_def_id)`, as it will cause a cycle
285285 ) ?,
286286 DefKind :: AssocTy | DefKind :: AssocConst | DefKind :: TyAlias => {
287- relation . relate ( a. args , b. args ) ?
287+ relate_args_invariantly ( relation , a. args , b. args ) ?
288288 }
289289 def => bug ! ( "unknown alias DefKind: {def:?}" ) ,
290290 } ;
@@ -329,7 +329,7 @@ impl<'tcx> Relate<'tcx> for ty::TraitRef<'tcx> {
329329 if a. def_id != b. def_id {
330330 Err ( TypeError :: Traits ( expected_found ( relation, a. def_id , b. def_id ) ) )
331331 } else {
332- let args = relate_args ( relation, a. args , b. args ) ?;
332+ let args = relate_args_invariantly ( relation, a. args , b. args ) ?;
333333 Ok ( ty:: TraitRef :: new ( relation. tcx ( ) , a. def_id , args) )
334334 }
335335 }
@@ -345,7 +345,7 @@ impl<'tcx> Relate<'tcx> for ty::ExistentialTraitRef<'tcx> {
345345 if a. def_id != b. def_id {
346346 Err ( TypeError :: Traits ( expected_found ( relation, a. def_id , b. def_id ) ) )
347347 } else {
348- let args = relate_args ( relation, a. args , b. args ) ?;
348+ let args = relate_args_invariantly ( relation, a. args , b. args ) ?;
349349 Ok ( ty:: ExistentialTraitRef { def_id : a. def_id , args } )
350350 }
351351 }
@@ -463,7 +463,7 @@ pub fn structurally_relate_tys<'tcx, R: TypeRelation<'tcx>>(
463463 // All Generator types with the same id represent
464464 // the (anonymous) type of the same generator expression. So
465465 // 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) ?;
467467 Ok ( Ty :: new_generator ( tcx, a_id, args, movability) )
468468 }
469469
@@ -473,15 +473,15 @@ pub fn structurally_relate_tys<'tcx, R: TypeRelation<'tcx>>(
473473 // All GeneratorWitness types with the same id represent
474474 // the (anonymous) type of the same generator expression. So
475475 // 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) ?;
477477 Ok ( Ty :: new_generator_witness ( tcx, a_id, args) )
478478 }
479479
480480 ( & ty:: Closure ( a_id, a_args) , & ty:: Closure ( b_id, b_args) ) if a_id == b_id => {
481481 // All Closure types with the same id represent
482482 // the (anonymous) type of the same closure expression. So
483483 // 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) ?;
485485 Ok ( Ty :: new_closure ( tcx, a_id, & args) )
486486 }
487487
@@ -705,7 +705,7 @@ impl<'tcx> Relate<'tcx> for ty::ClosureArgs<'tcx> {
705705 a : ty:: ClosureArgs < ' tcx > ,
706706 b : ty:: ClosureArgs < ' tcx > ,
707707 ) -> 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 ) ?;
709709 Ok ( ty:: ClosureArgs { args } )
710710 }
711711}
@@ -716,7 +716,7 @@ impl<'tcx> Relate<'tcx> for ty::GeneratorArgs<'tcx> {
716716 a : ty:: GeneratorArgs < ' tcx > ,
717717 b : ty:: GeneratorArgs < ' tcx > ,
718718 ) -> 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 ) ?;
720720 Ok ( ty:: GeneratorArgs { args } )
721721 }
722722}
@@ -727,7 +727,7 @@ impl<'tcx> Relate<'tcx> for GenericArgsRef<'tcx> {
727727 a : GenericArgsRef < ' tcx > ,
728728 b : GenericArgsRef < ' tcx > ,
729729 ) -> RelateResult < ' tcx , GenericArgsRef < ' tcx > > {
730- relate_args ( relation, a, b)
730+ relate_args_invariantly ( relation, a, b)
731731 }
732732}
733733
0 commit comments