summaryrefslogtreecommitdiffstats
path: root/tests/ui/unsafe/issue-115348-false-positive-warning-of-unnecessary-unsafe.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/unsafe/issue-115348-false-positive-warning-of-unnecessary-unsafe.rs')
-rw-r--r--tests/ui/unsafe/issue-115348-false-positive-warning-of-unnecessary-unsafe.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/ui/unsafe/issue-115348-false-positive-warning-of-unnecessary-unsafe.rs b/tests/ui/unsafe/issue-115348-false-positive-warning-of-unnecessary-unsafe.rs
new file mode 100644
index 000000000..68559338d
--- /dev/null
+++ b/tests/ui/unsafe/issue-115348-false-positive-warning-of-unnecessary-unsafe.rs
@@ -0,0 +1,16 @@
+// Regression test for #115348.
+
+unsafe fn uwu() {}
+
+// Tests that the false-positive warning "unnecessary `unsafe` block"
+// should not be reported, when the error "non-exhaustive patterns"
+// appears.
+
+fn foo(x: Option<u32>) {
+ match x {
+ //~^ ERROR non-exhaustive patterns: `None` not covered
+ Some(_) => unsafe { uwu() },
+ }
+}
+
+fn main() {}