Sign in
◑
Theme
android
/
toolchain
/
rustc
/
refs/heads/main
/
.
/
tests
/
ui
/
consts
/
const_unsafe_unreachable_ub.rs
blob: 705e208b56d796910a3ebc9e2e925a2fd69b5431 [
file
] [
edit
]
//@ 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
);
}