From 26c7bfd0b498abf313cf1cea10c992be2e606999 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Wed, 3 Jul 2024 08:31:40 +0200 Subject: [PATCH] Skip match exhaustiveness checking if pattern type contains errors --- crates/hir-ty/src/diagnostics/expr.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/hir-ty/src/diagnostics/expr.rs b/crates/hir-ty/src/diagnostics/expr.rs index ce3fa53f7a..c28ab2e98a 100644 --- a/crates/hir-ty/src/diagnostics/expr.rs +++ b/crates/hir-ty/src/diagnostics/expr.rs @@ -196,6 +196,9 @@ impl ExprValidator { let Some(pat_ty) = self.infer.type_of_pat.get(arm.pat) else { return; }; + if pat_ty.contains_unknown() { + return; + } // We only include patterns whose type matches the type // of the scrutinee expression. If we had an InvalidMatchArmPattern