aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/hir_ty/src/diagnostics/match_check.rs19
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#"
1342enum Option<T> { Some(T), None }
1343
1344fn 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