rust/tests/ui/unsafe/issue-115348-false-positive-warning-of-unnecessary-unsafe.rs

17 lines
365 B
Rust
Raw Normal View History

2023-09-06 04:46:39 -05:00
// 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() {}