rust/tests/ui/unsafe/issue-115348-false-positive-warning-of-unnecessary-unsafe.rs
2023-09-06 17:46:46 +08:00

17 lines
365 B
Rust

// 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() {}