@@ -18,12 +18,12 @@ use rustc_hir as hir;
1818use rustc_hir:: def:: { CtorOf , Res } ;
1919use rustc_hir:: def_id:: LocalDefId ;
2020use rustc_hir:: { HirId , PatKind } ;
21- use rustc_middle:: { bug, span_bug} ;
2221use rustc_middle:: hir:: place:: ProjectionKind ;
2322use rustc_middle:: mir:: FakeReadCause ;
2423use rustc_middle:: ty:: {
2524 self , adjustment, AdtKind , Ty , TyCtxt , TypeFoldable , TypeVisitableExt as _,
2625} ;
26+ use rustc_middle:: { bug, span_bug} ;
2727use rustc_span:: { ErrorGuaranteed , Span } ;
2828use rustc_target:: abi:: { FieldIdx , VariantIdx , FIRST_VARIANT } ;
2929use rustc_trait_selection:: infer:: InferCtxtExt ;
@@ -1181,6 +1181,10 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
11811181 debug ! ( "pat_ty(pat={:?}) found adjusted ty `{:?}`" , pat, first_ty) ;
11821182 return Ok ( * first_ty) ;
11831183 }
1184+ } else if let PatKind :: Ref ( subpat, _) = pat. kind
1185+ && self . cx . typeck_results ( ) . skipped_ref_pats ( ) . contains ( pat. hir_id )
1186+ {
1187+ return self . pat_ty_adjusted ( subpat) ;
11841188 }
11851189
11861190 self . pat_ty_unadjusted ( pat)
@@ -1712,6 +1716,12 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
17121716 self . cat_pattern ( place_with_id, subpat, op) ?;
17131717 }
17141718
1719+ PatKind :: Ref ( subpat, _)
1720+ if self . cx . typeck_results ( ) . skipped_ref_pats ( ) . contains ( pat. hir_id ) =>
1721+ {
1722+ self . cat_pattern ( place_with_id, subpat, op) ?;
1723+ }
1724+
17151725 PatKind :: Box ( subpat) | PatKind :: Ref ( subpat, _) => {
17161726 // box p1, &p1, &mut p1. we can ignore the mutability of
17171727 // PatKind::Ref since that information is already contained
0 commit comments