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
282 B
Rust
Raw Normal View History

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