]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const_unsafe_unreachable_ub.rs
Do not suggest `let_else` if no bindings would be introduced
[rust.git] / src / test / ui / consts / const_unsafe_unreachable_ub.rs
1 // error-pattern: evaluation of constant value failed
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(false) };
11
12 fn main() {
13     assert_eq!(BAR, true);
14 }