mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 09:14:20 +00:00
15 lines
275 B
Rust
15 lines
275 B
Rust
// error-pattern: evaluation of constant value failed
|
|
|
|
const unsafe fn foo(x: bool) -> bool {
|
|
match x {
|
|
true => true,
|
|
false => std::hint::unreachable_unchecked(),
|
|
}
|
|
}
|
|
|
|
const BAR: bool = unsafe { foo(false) };
|
|
|
|
fn main() {
|
|
assert_eq!(BAR, true);
|
|
}
|