Skip to content

Commit 73e2505

Browse files
committed
Auto merge of rust-lang#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 rust-lang/rust-analyzer#14222
2 parents 7c092a1 + 29150c2 commit 73e2505

File tree

3 files changed

+3
-10
lines changed

3 files changed

+3
-10
lines changed

crates/hir/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1466,6 +1466,9 @@ impl DefWithBody {
14661466
for (pat_or_expr, mismatch) in infer.type_mismatches() {
14671467
let expr_or_pat = match pat_or_expr {
14681468
ExprOrPatId::ExprId(expr) => source_map.expr_syntax(expr).map(Either::Left),
1469+
// FIXME: Re-enable these once we have less false positives
1470+
ExprOrPatId::PatId(_pat) => continue,
1471+
#[allow(unreachable_patterns)]
14691472
ExprOrPatId::PatId(pat) => source_map.pat_syntax(pat).map(Either::Right),
14701473
};
14711474
let expr_or_pat = match expr_or_pat {

crates/ide-diagnostics/src/handlers/missing_match_arms.rs

-8
Original file line numberDiff line numberDiff line change
@@ -273,20 +273,15 @@ enum Either2 { C, D }
273273
fn main() {
274274
match Either::A {
275275
Either2::C => (),
276-
// ^^^^^^^^^^ error: expected Either, found Either2
277276
Either2::D => (),
278-
// ^^^^^^^^^^ error: expected Either, found Either2
279277
}
280278
match (true, false) {
281279
(true, false, true) => (),
282-
// ^^^^^^^^^^^^^^^^^^^ error: expected (bool, bool), found (bool, bool, bool)
283280
(true) => (),
284281
// ^^^^ error: expected (bool, bool), found bool
285282
}
286283
match (true, false) { (true,) => {} }
287-
// ^^^^^^^ error: expected (bool, bool), found (bool,)
288284
match (0) { () => () }
289-
// ^^ error: expected i32, found ()
290285
match Unresolved::Bar { Unresolved::Baz => () }
291286
}
292287
"#,
@@ -300,9 +295,7 @@ fn main() {
300295
r#"
301296
fn main() {
302297
match false { true | () => {} }
303-
// ^^ error: expected bool, found ()
304298
match (false,) { (true | (),) => {} }
305-
// ^^ error: expected bool, found ()
306299
}
307300
"#,
308301
);
@@ -1050,7 +1043,6 @@ fn main() {
10501043
fn main() {
10511044
match (&false,) {
10521045
(true,) => {}
1053-
// ^^^^^^^ error: expected (&bool,), found (bool,)
10541046
}
10551047
match (&false,) {
10561048
(&true,) => {}

crates/ide-diagnostics/src/handlers/type_mismatch.rs

-2
Original file line numberDiff line numberDiff line change
@@ -617,10 +617,8 @@ fn f() -> i32 {
617617
r#"
618618
fn f() {
619619
let &() = &mut ();
620-
//^^^ error: expected &mut (), found &()
621620
match &() {
622621
&9 => ()
623-
//^^ error: expected &(), found &i32
624622
//^ error: expected (), found i32
625623
}
626624
}

0 commit comments

Comments
 (0)