mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Document missing match arm false positive
This should already be guarded against
(d2212a49f6/crates/hir_ty/src/diagnostics/expr.rs (L225-L230)
)
but it isn't preventing this false positive for some reason.
This commit is contained in:
parent
7d95a8447c
commit
2eaf79cfbb
1 changed files with 19 additions and 0 deletions
|
@ -1335,6 +1335,25 @@ fn panic(a: Category, b: Category) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn unknown_type() {
|
||||||
|
check_diagnostics(
|
||||||
|
r#"
|
||||||
|
enum Option<T> { Some(T), None }
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
// FIXME: This is a false positive, as the `Never` type is not known here.
|
||||||
|
// `Never` is deliberately not defined so that it's an uninferred type.
|
||||||
|
match Option::<Never>::None {
|
||||||
|
None => (),
|
||||||
|
Some(never) => match never {},
|
||||||
|
// ^^^^^ Missing match arm
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
mod false_negatives {
|
mod false_negatives {
|
||||||
//! The implementation of match checking here is a work in progress. As we roll this out, we
|
//! The implementation of match checking here is a work in progress. As we roll this out, we
|
||||||
//! prefer false negatives to false positives (ideally there would be no false positives). This
|
//! prefer false negatives to false positives (ideally there would be no false positives). This
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue