summaryrefslogtreecommitdiffstats
path: root/tests/ui/intrinsics/intrinsic-assume.rs
blob: 3c9d70cb556bf3d2c22b671c7909472bc1c6be99 (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::assume;

unsafe fn f(x: i32) -> i32 {
    assume(x == 34);
    match x {
        34 => 42,
        _  => 30
    }
}

fn main() {
    let x = unsafe { f(34) };
    assert_eq!(x, 42);
}