mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-28 20:16:58 +03:00
Document missing match arm false positive
This should already be guarded against (https://github.com/rust-analyzer/rust-analyzer/blob/d2212a49f6d447a14cdc87a9de2a4844e78b6905/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:
@@ -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 {
|
||||
//! 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
|
||||
|
||||
Reference in New Issue
Block a user