summaryrefslogtreecommitdiffstats
path: root/tests/ui/consts/const_unsafe_unreachable.rs
blob: 1c3baec5d8638cbd7dd016494a0db5e94199da38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// run-pass

const unsafe fn foo(x: bool) -> bool {
    match x {
        true => true,
        false => std::hint::unreachable_unchecked(),
    }
}

const BAR: bool = unsafe { foo(true) };

fn main() {
    assert_eq!(BAR, true);
}