mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00

`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.
24 lines
362 B
Rust
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();
|
|
}
|