rust/tests/ui/asm/x86_64/goto-block-safe.rs
Gary Guo 809dc73d90 Make asm label blocks safe context
`asm!()` is forced to be wrapped inside unsafe. If there's no special
treatment, the label blocks would also always be unsafe with no way
of opting out.
2024-10-11 11:54:30 +01:00

24 lines
362 B
Rust

//@ only-x86_64
//@ needs-asm-support
#![deny(unreachable_code)]
#![feature(asm_goto)]
use std::arch::asm;
fn goto_fallthough() {
unsafe {
asm!(
"/* {} */",
label {
core::hint::unreachable_unchecked();
//~^ ERROR [E0133]
}
)
}
}
fn main() {
goto_fallthough();
}