2021-06-18 19:31:56 +02:00
|
|
|
// error-pattern: evaluation of constant value failed
|
2020-07-17 22:03:33 +02:00
|
|
|
|
|
|
|
const unsafe fn foo(x: bool) -> bool {
|
|
|
|
match x {
|
|
|
|
true => true,
|
|
|
|
false => std::hint::unreachable_unchecked(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const BAR: bool = unsafe { foo(false) };
|
|
|
|
|
|
|
|
fn main() {
|
2021-10-04 01:04:17 -04:00
|
|
|
assert_eq!(BAR, true);
|
2020-07-17 22:03:33 +02:00
|
|
|
}
|