diff options
author | CAD97 <[email protected]> | 2020-08-17 18:19:15 +0100 |
---|---|---|
committer | CAD97 <[email protected]> | 2020-08-17 18:19:15 +0100 |
commit | 2eaf79cfbb447156151cb5435eff5f14f41c40f7 (patch) | |
tree | a0363a0316057ef330faef5fa513ea121bb826e1 | |
parent | 7d95a8447cf1874dac6381b5b1e644093b72e435 (diff) |
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.
-rw-r--r-- | crates/hir_ty/src/diagnostics/match_check.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/crates/hir_ty/src/diagnostics/match_check.rs b/crates/hir_ty/src/diagnostics/match_check.rs index 7f007f1d6..1602c3fb4 100644 --- a/crates/hir_ty/src/diagnostics/match_check.rs +++ b/crates/hir_ty/src/diagnostics/match_check.rs | |||
@@ -1335,6 +1335,25 @@ fn panic(a: Category, b: Category) { | |||
1335 | ); | 1335 | ); |
1336 | } | 1336 | } |
1337 | 1337 | ||
1338 | #[test] | ||
1339 | fn unknown_type() { | ||
1340 | check_diagnostics( | ||
1341 | r#" | ||
1342 | enum Option<T> { Some(T), None } | ||
1343 | |||
1344 | fn main() { | ||
1345 | // FIXME: This is a false positive, as the `Never` type is not known here. | ||
1346 | // `Never` is deliberately not defined so that it's an uninferred type. | ||
1347 | match Option::<Never>::None { | ||
1348 | None => (), | ||
1349 | Some(never) => match never {}, | ||
1350 | // ^^^^^ Missing match arm | ||
1351 | } | ||
1352 | } | ||
1353 | "#, | ||
1354 | ); | ||
1355 | } | ||
1356 | |||
1338 | mod false_negatives { | 1357 | mod false_negatives { |
1339 | //! The implementation of match checking here is a work in progress. As we roll this out, we | 1358 | //! The implementation of match checking here is a work in progress. As we roll this out, we |
1340 | //! prefer false negatives to false positives (ideally there would be no false positives). This | 1359 | //! prefer false negatives to false positives (ideally there would be no false positives). This |