mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 06:51:58 +00:00
15 lines
232 B
Rust
15 lines
232 B
Rust
// run-pass
|
|
|
|
const unsafe fn foo(x: bool) -> bool {
|
|
match x {
|
|
true => true,
|
|
false => std::hint::unreachable_unchecked(),
|
|
}
|
|
}
|
|
|
|
const BAR: bool = unsafe { foo(true) };
|
|
|
|
fn main() {
|
|
assert_eq!(BAR, true);
|
|
}
|