@@ -365,7 +365,6 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
365
365
if let Some ( annotation_index) = constant. user_ty {
366
366
if let Err ( terr) = self . cx . relate_type_and_user_type (
367
367
constant. literal . ty ( ) ,
368
- ty:: Variance :: Invariant ,
369
368
& UserTypeProjection { base : annotation_index, projs : vec ! [ ] } ,
370
369
location. to_locations ( ) ,
371
370
ConstraintCategory :: Boring ,
@@ -425,6 +424,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
425
424
ConstraintCategory :: Boring ,
426
425
self . cx . param_env . and ( type_op:: ascribe_user_type:: AscribeUserType :: new (
427
426
constant. literal . ty ( ) ,
427
+ ty:: Variance :: Invariant ,
428
428
uv. def . did ,
429
429
UserSubsts { substs : uv. substs , user_self_ty : None } ,
430
430
) ) ,
@@ -492,7 +492,6 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
492
492
493
493
if let Err ( terr) = self . cx . relate_type_and_user_type (
494
494
ty,
495
- ty:: Variance :: Invariant ,
496
495
user_ty,
497
496
Locations :: All ( * span) ,
498
497
ConstraintCategory :: TypeAnnotation ,
@@ -1108,6 +1107,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1108
1107
ConstraintCategory :: BoringNoLocation ,
1109
1108
self . param_env . and ( type_op:: ascribe_user_type:: AscribeUserType :: new (
1110
1109
inferred_ty,
1110
+ variance,
1111
1111
def_id,
1112
1112
user_substs,
1113
1113
) ) ,
@@ -1178,7 +1178,6 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1178
1178
fn relate_type_and_user_type (
1179
1179
& mut self ,
1180
1180
a : Ty < ' tcx > ,
1181
- v : ty:: Variance ,
1182
1181
user_ty : & UserTypeProjection ,
1183
1182
locations : Locations ,
1184
1183
category : ConstraintCategory ,
@@ -1206,7 +1205,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1206
1205
) ;
1207
1206
1208
1207
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) ?;
1210
1209
1211
1210
Ok ( ( ) )
1212
1211
}
@@ -1401,7 +1400,6 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1401
1400
if let Some ( annotation_index) = self . rvalue_user_ty ( rv) {
1402
1401
if let Err ( terr) = self . relate_type_and_user_type (
1403
1402
rv_ty,
1404
- ty:: Variance :: Invariant ,
1405
1403
& UserTypeProjection { base : annotation_index, projs : vec ! [ ] } ,
1406
1404
location. to_locations ( ) ,
1407
1405
ConstraintCategory :: Boring ,
@@ -1453,11 +1451,10 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1453
1451
) ;
1454
1452
} ;
1455
1453
}
1456
- StatementKind :: AscribeUserType ( box ( ref place, ref projection) , variance ) => {
1454
+ StatementKind :: AscribeUserType ( box ( ref place, ref projection) ) => {
1457
1455
let place_ty = place. ty ( body, tcx) . ty ;
1458
1456
if let Err ( terr) = self . relate_type_and_user_type (
1459
1457
place_ty,
1460
- variance,
1461
1458
projection,
1462
1459
Locations :: All ( stmt. source_info . span ) ,
1463
1460
ConstraintCategory :: TypeAnnotation ,
0 commit comments