]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const_unsafe_unreachable.rs
Rollup merge of #105843 - compiler-errors:sugg-const, r=lcnr
[rust.git] / src / test / 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 }