@@ -18,6 +18,7 @@ use rustc_middle::mir::interpret::LitToConstInput;
1818use rustc_middle:: thir:: {
1919 Ascription , FieldPat , LocalVarId , Pat , PatKind , PatRange , PatRangeBoundary ,
2020} ;
21+ use rustc_middle:: ty:: adjustment:: PatAdjustment ;
2122use rustc_middle:: ty:: layout:: IntegerExt ;
2223use rustc_middle:: ty:: { self , CanonicalUserTypeAnnotation , Ty , TyCtxt , TypingMode } ;
2324use rustc_middle:: { bug, span_bug} ;
@@ -63,7 +64,7 @@ pub(super) fn pat_from_hir<'a, 'tcx>(
6364
6465impl < ' a , ' tcx > PatCtxt < ' a , ' tcx > {
6566 fn lower_pattern ( & mut self , pat : & ' tcx hir:: Pat < ' tcx > ) -> Box < Pat < ' tcx > > {
66- let adjustments: & [ Ty < ' tcx > ] =
67+ let adjustments: & [ PatAdjustment < ' tcx > ] =
6768 self . typeck_results . pat_adjustments ( ) . get ( pat. hir_id ) . map_or ( & [ ] , |v| & * * v) ;
6869
6970 // Track the default binding mode for the Rust 2024 migration suggestion.
@@ -102,11 +103,11 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
102103 _ => self . lower_pattern_unadjusted ( pat) ,
103104 } ;
104105
105- let adjusted_pat = adjustments. iter ( ) . rev ( ) . fold ( unadjusted_pat, |thir_pat, ref_ty | {
106- debug ! ( "{:?}: wrapping pattern with type {:?}" , thir_pat, ref_ty ) ;
106+ let adjusted_pat = adjustments. iter ( ) . rev ( ) . fold ( unadjusted_pat, |thir_pat, adjust | {
107+ debug ! ( "{:?}: wrapping pattern with type {:?}" , thir_pat, adjust ) ;
107108 Box :: new ( Pat {
108109 span : thir_pat. span ,
109- ty : * ref_ty ,
110+ ty : adjust . source ,
110111 kind : PatKind :: Deref { subpattern : thir_pat } ,
111112 } )
112113 } ) ;
0 commit comments