@@ -19,7 +19,7 @@ use rustc_index::bit_set::BitSet;
19
19
use rustc_middle:: middle:: region;
20
20
use rustc_middle:: mir:: * ;
21
21
use rustc_middle:: thir:: { self , * } ;
22
- use rustc_middle:: ty:: { self , CanonicalUserTypeAnnotation , Ty } ;
22
+ use rustc_middle:: ty:: { self , CanonicalUserTypeAnnotation , Ty , Variance } ;
23
23
use rustc_span:: symbol:: Symbol ;
24
24
use rustc_span:: { BytePos , Pos , Span } ;
25
25
use rustc_target:: abi:: VariantIdx ;
@@ -538,8 +538,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
538
538
let ty_source_info = self . source_info ( user_ty_span) ;
539
539
let user_ty = pat_ascription_ty. user_ty (
540
540
& mut self . canonical_user_type_annotations ,
541
- place. ty ( & self . local_decls , self . tcx ) . ty ,
542
541
ty_source_info. span ,
542
+ place. ty ( & self . local_decls , self . tcx ) . ty ,
543
+ Variance :: Invariant ,
543
544
) ;
544
545
self . cfg . push (
545
546
block,
@@ -796,6 +797,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
796
797
span : user_ty_span,
797
798
user_ty : user_ty. user_ty ,
798
799
inferred_ty : subpattern. ty ,
800
+ variance : Variance :: Invariant ,
799
801
} ;
800
802
let projection = UserTypeProjection {
801
803
base : self . canonical_user_type_annotations . push ( annotation) ,
@@ -2076,8 +2078,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2076
2078
2077
2079
let user_ty = ascription. user_ty . user_ty (
2078
2080
& mut self . canonical_user_type_annotations ,
2079
- ascription. source . ty ( & self . local_decls , self . tcx ) . ty ,
2080
2081
source_info. span ,
2082
+ ascription. source . ty ( & self . local_decls , self . tcx ) . ty ,
2083
+ ascription. variance ,
2081
2084
) ;
2082
2085
self . cfg . push (
2083
2086
block,
0 commit comments