diff options
| author | bors <bors@rust-lang.org> | 2024-07-03 06:34:39 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-07-03 06:34:39 +0000 |
| commit | 7789db23784eabd2dac20434eaed98ba0faad131 (patch) | |
| tree | c88457ca1b2f680c9f06b4de26905076cd777d32 /src/tools | |
| parent | 260a380e09b32d9209a78de47125afdc0077e0d0 (diff) | |
| parent | 8f8f440cb29f34aacac3aba05023473f01008b3f (diff) | |
Auto merge of #17534 - Veykril:skip-unknown-match-check, r=Veykril
fix: Skip match exhaustiveness checking if pattern type contains errors Should fix https://github.com/rust-lang/rust-analyzer/issues/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
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/expr.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/expr.rs b/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/expr.rs index ce3fa53f7ad..c28ab2e98af 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/expr.rs +++ b/src/tools/rust-analyzer/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 |
