From 96af415476968d91847dde81c8ac907823b0def0 Mon Sep 17 00:00:00 2001 From: b-naber Date: Mon, 17 Jul 2023 21:58:05 +0000 Subject: [PATCH] try to structurally resolve before try_resolve_slice_ty_to_array_ty --- compiler/rustc_hir_typeck/src/pat.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler/rustc_hir_typeck/src/pat.rs b/compiler/rustc_hir_typeck/src/pat.rs index 8e14212fd56..e0b7407a5ee 100644 --- a/compiler/rustc_hir_typeck/src/pat.rs +++ b/compiler/rustc_hir_typeck/src/pat.rs @@ -2114,6 +2114,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { expected: Ty<'tcx>, pat_info: PatInfo<'tcx, '_>, ) -> Ty<'tcx> { + let expected = self.try_structurally_resolve_type(span, expected); + // If the pattern is irrefutable and `expected` is an infer ty, we try to equate it // to an array if the given pattern allows it. See issue #76342 if self.pat_is_irrefutable(pat_info.decl_origin) && expected.is_ty_var() {