@@ -19,7 +19,7 @@ use rustc_index::bit_set::BitSet;
1919use rustc_middle:: middle:: region;
2020use rustc_middle:: mir:: * ;
2121use rustc_middle:: thir:: { self , * } ;
22- use rustc_middle:: ty:: { self , CanonicalUserTypeAnnotation , Ty } ;
22+ use rustc_middle:: ty:: { self , CanonicalUserTypeAnnotation , Ty , Variance } ;
2323use rustc_span:: symbol:: Symbol ;
2424use rustc_span:: { BytePos , Pos , Span } ;
2525use rustc_target:: abi:: VariantIdx ;
@@ -538,8 +538,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
538538 let ty_source_info = self . source_info ( user_ty_span) ;
539539 let user_ty = pat_ascription_ty. user_ty (
540540 & mut self . canonical_user_type_annotations ,
541- place. ty ( & self . local_decls , self . tcx ) . ty ,
542541 ty_source_info. span ,
542+ place. ty ( & self . local_decls , self . tcx ) . ty ,
543+ Variance :: Invariant ,
543544 ) ;
544545 self . cfg . push (
545546 block,
@@ -796,6 +797,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
796797 span : user_ty_span,
797798 user_ty : user_ty. user_ty ,
798799 inferred_ty : subpattern. ty ,
800+ variance : Variance :: Invariant ,
799801 } ;
800802 let projection = UserTypeProjection {
801803 base : self . canonical_user_type_annotations . push ( annotation) ,
@@ -2076,8 +2078,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
20762078
20772079 let user_ty = ascription. user_ty . user_ty (
20782080 & mut self . canonical_user_type_annotations ,
2079- ascription. source . ty ( & self . local_decls , self . tcx ) . ty ,
20802081 source_info. span ,
2082+ ascription. source . ty ( & self . local_decls , self . tcx ) . ty ,
2083+ ascription. variance ,
20812084 ) ;
20822085 self . cfg . push (
20832086 block,
0 commit comments