diff options
| author | bors <bors@rust-lang.org> | 2023-03-03 21:41:55 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-03-03 21:41:55 +0000 |
| commit | 73e2505cfa8be6838f5151b272f1d24869b2a3d6 (patch) | |
| tree | 0f59dc7466f8464b49d80b2e7d9b3d5d00df06d9 | |
| parent | 7c092a13bf9779239cc99fe4b473af20b8f95482 (diff) | |
| parent | 29150c23153ecb611d7c578a5d63fef87a97de42 (diff) | |
Auto merge of #14245 - Veykril:pat-diags, r=Veykril
Disable pattern type mismatches again We have too many false mismatches at the moment for these to be enabled cc https://github.com/rust-lang/rust-analyzer/pull/14222
| -rw-r--r-- | crates/hir/src/lib.rs | 3 | ||||
| -rw-r--r-- | crates/ide-diagnostics/src/handlers/missing_match_arms.rs | 8 | ||||
| -rw-r--r-- | crates/ide-diagnostics/src/handlers/type_mismatch.rs | 2 |
3 files changed, 3 insertions, 10 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 269c45943e5..20009698f91 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -1466,6 +1466,9 @@ impl DefWithBody { for (pat_or_expr, mismatch) in infer.type_mismatches() { let expr_or_pat = match pat_or_expr { ExprOrPatId::ExprId(expr) => source_map.expr_syntax(expr).map(Either::Left), + // FIXME: Re-enable these once we have less false positives + ExprOrPatId::PatId(_pat) => continue, + #[allow(unreachable_patterns)] ExprOrPatId::PatId(pat) => source_map.pat_syntax(pat).map(Either::Right), }; let expr_or_pat = match expr_or_pat { diff --git a/crates/ide-diagnostics/src/handlers/missing_match_arms.rs b/crates/ide-diagnostics/src/handlers/missing_match_arms.rs index 6594eed26d1..5ded2f22309 100644 --- a/crates/ide-diagnostics/src/handlers/missing_match_arms.rs +++ b/crates/ide-diagnostics/src/handlers/missing_match_arms.rs @@ -273,20 +273,15 @@ enum Either2 { C, D } fn main() { match Either::A { Either2::C => (), - // ^^^^^^^^^^ error: expected Either, found Either2 Either2::D => (), - // ^^^^^^^^^^ error: expected Either, found Either2 } match (true, false) { (true, false, true) => (), - // ^^^^^^^^^^^^^^^^^^^ error: expected (bool, bool), found (bool, bool, bool) (true) => (), // ^^^^ error: expected (bool, bool), found bool } match (true, false) { (true,) => {} } - // ^^^^^^^ error: expected (bool, bool), found (bool,) match (0) { () => () } - // ^^ error: expected i32, found () match Unresolved::Bar { Unresolved::Baz => () } } "#, @@ -300,9 +295,7 @@ fn main() { r#" fn main() { match false { true | () => {} } - // ^^ error: expected bool, found () match (false,) { (true | (),) => {} } - // ^^ error: expected bool, found () } "#, ); @@ -1050,7 +1043,6 @@ fn main() { fn main() { match (&false,) { (true,) => {} - // ^^^^^^^ error: expected (&bool,), found (bool,) } match (&false,) { (&true,) => {} diff --git a/crates/ide-diagnostics/src/handlers/type_mismatch.rs b/crates/ide-diagnostics/src/handlers/type_mismatch.rs index 2026a2d4b8a..b57a13e53e6 100644 --- a/crates/ide-diagnostics/src/handlers/type_mismatch.rs +++ b/crates/ide-diagnostics/src/handlers/type_mismatch.rs @@ -617,10 +617,8 @@ fn f() -> i32 { r#" fn f() { let &() = &mut (); - //^^^ error: expected &mut (), found &() match &() { &9 => () - //^^ error: expected &(), found &i32 //^ error: expected (), found i32 } } |
