mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 13:33:31 +00:00
Disable pattern type mismatches again
This commit is contained in:
parent
7c092a13bf
commit
29150c2315
3 changed files with 3 additions and 10 deletions
|
@ -1466,6 +1466,9 @@ impl DefWithBody {
|
||||||
for (pat_or_expr, mismatch) in infer.type_mismatches() {
|
for (pat_or_expr, mismatch) in infer.type_mismatches() {
|
||||||
let expr_or_pat = match pat_or_expr {
|
let expr_or_pat = match pat_or_expr {
|
||||||
ExprOrPatId::ExprId(expr) => source_map.expr_syntax(expr).map(Either::Left),
|
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),
|
ExprOrPatId::PatId(pat) => source_map.pat_syntax(pat).map(Either::Right),
|
||||||
};
|
};
|
||||||
let expr_or_pat = match expr_or_pat {
|
let expr_or_pat = match expr_or_pat {
|
||||||
|
|
|
@ -273,20 +273,15 @@ enum Either2 { C, D }
|
||||||
fn main() {
|
fn main() {
|
||||||
match Either::A {
|
match Either::A {
|
||||||
Either2::C => (),
|
Either2::C => (),
|
||||||
// ^^^^^^^^^^ error: expected Either, found Either2
|
|
||||||
Either2::D => (),
|
Either2::D => (),
|
||||||
// ^^^^^^^^^^ error: expected Either, found Either2
|
|
||||||
}
|
}
|
||||||
match (true, false) {
|
match (true, false) {
|
||||||
(true, false, true) => (),
|
(true, false, true) => (),
|
||||||
// ^^^^^^^^^^^^^^^^^^^ error: expected (bool, bool), found (bool, bool, bool)
|
|
||||||
(true) => (),
|
(true) => (),
|
||||||
// ^^^^ error: expected (bool, bool), found bool
|
// ^^^^ error: expected (bool, bool), found bool
|
||||||
}
|
}
|
||||||
match (true, false) { (true,) => {} }
|
match (true, false) { (true,) => {} }
|
||||||
// ^^^^^^^ error: expected (bool, bool), found (bool,)
|
|
||||||
match (0) { () => () }
|
match (0) { () => () }
|
||||||
// ^^ error: expected i32, found ()
|
|
||||||
match Unresolved::Bar { Unresolved::Baz => () }
|
match Unresolved::Bar { Unresolved::Baz => () }
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
|
@ -300,9 +295,7 @@ fn main() {
|
||||||
r#"
|
r#"
|
||||||
fn main() {
|
fn main() {
|
||||||
match false { true | () => {} }
|
match false { true | () => {} }
|
||||||
// ^^ error: expected bool, found ()
|
|
||||||
match (false,) { (true | (),) => {} }
|
match (false,) { (true | (),) => {} }
|
||||||
// ^^ error: expected bool, found ()
|
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
|
@ -1050,7 +1043,6 @@ fn main() {
|
||||||
fn main() {
|
fn main() {
|
||||||
match (&false,) {
|
match (&false,) {
|
||||||
(true,) => {}
|
(true,) => {}
|
||||||
// ^^^^^^^ error: expected (&bool,), found (bool,)
|
|
||||||
}
|
}
|
||||||
match (&false,) {
|
match (&false,) {
|
||||||
(&true,) => {}
|
(&true,) => {}
|
||||||
|
|
|
@ -617,10 +617,8 @@ fn f() -> i32 {
|
||||||
r#"
|
r#"
|
||||||
fn f() {
|
fn f() {
|
||||||
let &() = &mut ();
|
let &() = &mut ();
|
||||||
//^^^ error: expected &mut (), found &()
|
|
||||||
match &() {
|
match &() {
|
||||||
&9 => ()
|
&9 => ()
|
||||||
//^^ error: expected &(), found &i32
|
|
||||||
//^ error: expected (), found i32
|
//^ error: expected (), found i32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue