Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-diagnostics/src/handlers/non_exhaustive_let.rs')
-rw-r--r--crates/ide-diagnostics/src/handlers/non_exhaustive_let.rs32
1 files changed, 32 insertions, 0 deletions
diff --git a/crates/ide-diagnostics/src/handlers/non_exhaustive_let.rs b/crates/ide-diagnostics/src/handlers/non_exhaustive_let.rs
index 5a6977c255..9aace992ae 100644
--- a/crates/ide-diagnostics/src/handlers/non_exhaustive_let.rs
+++ b/crates/ide-diagnostics/src/handlers/non_exhaustive_let.rs
@@ -80,6 +80,38 @@ fn main() {
//^^^^ error: non-exhaustive pattern: `Some(_)` not covered
}
}
+"#
+ );
+ }
+
+ #[test]
+ fn min_exhaustive() {
+ check_diagnostics(
+ r#"
+//- minicore: result
+fn test(x: Result<i32, !>) {
+ let Ok(_y) = x;
+}
+"#,
+ );
+ check_diagnostics(
+ r#"
+//- minicore: result
+fn test(ptr: *const Result<i32, !>) {
+ unsafe {
+ let Ok(_x) = *ptr;
+ //^^^^^^ error: non-exhaustive pattern: `Err(_)` not covered
+ }
+}
+"#,
+ );
+ check_diagnostics(
+ r#"
+//- minicore: result
+fn test(x: Result<i32, &'static !>) {
+ let Ok(_y) = x;
+ //^^^^^^ error: non-exhaustive pattern: `Err(_)` not covered
+}
"#,
);
}