Auto merge of #125084 - Jules-Bertholet:fix-125058, r=Nadrieril · rust-lang/rust@0160bff (original) (raw)
`@@ -18,12 +18,12 @@ use rustc_hir as hir;
`
18
18
`use rustc_hir::def::{CtorOf, Res};
`
19
19
`use rustc_hir::def_id::LocalDefId;
`
20
20
`use rustc_hir::{HirId, PatKind};
`
21
``
`-
use rustc_middle::{bug, span_bug};
`
22
21
`use rustc_middle::hir::place::ProjectionKind;
`
23
22
`use rustc_middle::mir::FakeReadCause;
`
24
23
`use rustc_middle::ty::{
`
25
24
`self, adjustment, AdtKind, Ty, TyCtxt, TypeFoldable, TypeVisitableExt as _,
`
26
25
`};
`
``
26
`+
use rustc_middle::{bug, span_bug};
`
27
27
`use rustc_span::{ErrorGuaranteed, Span};
`
28
28
`use rustc_target::abi::{FieldIdx, VariantIdx, FIRST_VARIANT};
`
29
29
`use rustc_trait_selection::infer::InferCtxtExt;
`
`@@ -1181,6 +1181,10 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
`
1181
1181
`` debug!("pat_ty(pat={:?}) found adjusted ty {:?}
", pat, first_ty);
``
1182
1182
`return Ok(*first_ty);
`
1183
1183
`}
`
``
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);
`
1184
1188
`}
`
1185
1189
``
1186
1190
`self.pat_ty_unadjusted(pat)
`
`@@ -1712,6 +1716,12 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
`
1712
1716
`self.cat_pattern(place_with_id, subpat, op)?;
`
1713
1717
`}
`
1714
1718
``
``
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
+
1715
1725
`PatKind::Box(subpat) | PatKind::Ref(subpat, _) => {
`
1716
1726
`// box p1, &p1, &mut p1. we can ignore the mutability of
`
1717
1727
`// PatKind::Ref since that information is already contained
`