Skip to content

Commit 848e0c4

Browse files
committed
Auto merge of #17534 - Veykril:skip-unknown-match-check, r=Veykril
fix: Skip match exhaustiveness checking if pattern type contains errors Should fix #17509, checking when errors are involved is generally a bad idea as the algorithm doesn't really expect error types in the first place I believe
2 parents 4981f00 + 26c7bfd commit 848e0c4

File tree

1 file changed

+3
-0
lines changed
  • crates/hir-ty/src/diagnostics

1 file changed

+3
-0
lines changed

crates/hir-ty/src/diagnostics/expr.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,9 @@ impl ExprValidator {
196196
let Some(pat_ty) = self.infer.type_of_pat.get(arm.pat) else {
197197
return;
198198
};
199+
if pat_ty.contains_unknown() {
200+
return;
201+
}
199202

200203
// We only include patterns whose type matches the type
201204
// of the scrutinee expression. If we had an InvalidMatchArmPattern

0 commit comments

Comments
 (0)