rust/tests/ui/intrinsics/intrinsic-unreachable.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
281 B
Rust
Raw Normal View History

// run-pass
#![feature(core_intrinsics)]
2014-09-04 18:09:18 -05:00
use std::intrinsics;
// See also tests/run-make/intrinsic-unreachable.
2014-09-04 18:09:18 -05:00
unsafe fn f(x: usize) -> usize {
2014-09-04 18:09:18 -05:00
match x {
17 => 23,
_ => intrinsics::unreachable(),
}
}
fn main() {
assert_eq!(unsafe { f(17) }, 23);
}