summaryrefslogtreecommitdiffstats
path: root/tests/ui/unsafe/issue-115348-false-positive-warning-of-unnecessary-unsafe.rs
blob: 68559338d4986f86faedec3ebca9c8a1b024a331 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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() {}