Skip to content

Commit

Permalink
try to structurally resolve before try_resolve_slice_ty_to_array_ty
Browse files Browse the repository at this point in the history
  • Loading branch information
b-naber committed Jul 17, 2023
1 parent 65f92a5 commit 96af415
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions compiler/rustc_hir_typeck/src/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 96af415

Please sign in to comment.