@@ -365,7 +365,6 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
365365 if let Some ( annotation_index) = constant. user_ty {
366366 if let Err ( terr) = self . cx . relate_type_and_user_type (
367367 constant. literal . ty ( ) ,
368- ty:: Variance :: Invariant ,
369368 & UserTypeProjection { base : annotation_index, projs : vec ! [ ] } ,
370369 location. to_locations ( ) ,
371370 ConstraintCategory :: Boring ,
@@ -425,6 +424,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
425424 ConstraintCategory :: Boring ,
426425 self . cx . param_env . and ( type_op:: ascribe_user_type:: AscribeUserType :: new (
427426 constant. literal . ty ( ) ,
427+ ty:: Variance :: Invariant ,
428428 uv. def . did ,
429429 UserSubsts { substs : uv. substs , user_self_ty : None } ,
430430 ) ) ,
@@ -492,7 +492,6 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
492492
493493 if let Err ( terr) = self . cx . relate_type_and_user_type (
494494 ty,
495- ty:: Variance :: Invariant ,
496495 user_ty,
497496 Locations :: All ( * span) ,
498497 ConstraintCategory :: TypeAnnotation ,
@@ -1108,6 +1107,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
11081107 ConstraintCategory :: BoringNoLocation ,
11091108 self . param_env . and ( type_op:: ascribe_user_type:: AscribeUserType :: new (
11101109 inferred_ty,
1110+ variance,
11111111 def_id,
11121112 user_substs,
11131113 ) ) ,
@@ -1178,7 +1178,6 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
11781178 fn relate_type_and_user_type (
11791179 & mut self ,
11801180 a : Ty < ' tcx > ,
1181- v : ty:: Variance ,
11821181 user_ty : & UserTypeProjection ,
11831182 locations : Locations ,
11841183 category : ConstraintCategory ,
@@ -1206,7 +1205,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
12061205 ) ;
12071206
12081207 let ty = curr_projected_ty. ty ;
1209- self . relate_types ( ty, v . xform ( ty:: Variance :: Contravariant ) , a, locations, category) ?;
1208+ self . relate_types ( ty, ty:: Variance :: Invariant , a, locations, category) ?;
12101209
12111210 Ok ( ( ) )
12121211 }
@@ -1401,7 +1400,6 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
14011400 if let Some ( annotation_index) = self . rvalue_user_ty ( rv) {
14021401 if let Err ( terr) = self . relate_type_and_user_type (
14031402 rv_ty,
1404- ty:: Variance :: Invariant ,
14051403 & UserTypeProjection { base : annotation_index, projs : vec ! [ ] } ,
14061404 location. to_locations ( ) ,
14071405 ConstraintCategory :: Boring ,
@@ -1453,11 +1451,10 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
14531451 ) ;
14541452 } ;
14551453 }
1456- StatementKind :: AscribeUserType ( box ( ref place, ref projection) , variance ) => {
1454+ StatementKind :: AscribeUserType ( box ( ref place, ref projection) ) => {
14571455 let place_ty = place. ty ( body, tcx) . ty ;
14581456 if let Err ( terr) = self . relate_type_and_user_type (
14591457 place_ty,
1460- variance,
14611458 projection,
14621459 Locations :: All ( stmt. source_info . span ) ,
14631460 ConstraintCategory :: TypeAnnotation ,
0 commit comments