1
Fork 0

Add a passing test for const unsafe_unreachable

This commit is contained in:
Nazım Can Altınova 2020-07-17 21:59:37 +02:00
parent 4fefa2c75d
commit 2f28d5945d

View file

@ -0,0 +1,17 @@
// run-pass
#![feature(const_fn)]
#![feature(const_unreachable_unchecked)]
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);
}