summaryrefslogtreecommitdiffstats
path: root/src/test/ui/intrinsics/intrinsic-unreachable.rs
blob: da1a32d58eac718e88871a9a32fc4c2293eb67f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// run-pass
#![feature(core_intrinsics)]

use std::intrinsics;

// See also src/test/run-make/intrinsic-unreachable.

unsafe fn f(x: usize) -> usize {
    match x {
        17 => 23,
        _ => intrinsics::unreachable(),
    }
}

fn main() {
    assert_eq!(unsafe { f(17) }, 23);
}