]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/const_unsafe_unreachable.rs
Rollup merge of #106717 - klensy:typo, r=lcnr
[rust.git] / tests / ui / consts / const_unsafe_unreachable.rs
1 // run-pass
2
3 const unsafe fn foo(x: bool) -> bool {
4     match x {
5         true => true,
6         false => std::hint::unreachable_unchecked(),
7     }
8 }
9
10 const BAR: bool = unsafe { foo(true) };
11
12 fn main() {
13     assert_eq!(BAR, true);
14 }