rust/tests/ui/asm/binary_asm_labels_allowed.rs
Trevor Gross 9387a7523e Change binary_asm_labels to only fire on x86 and x86_64
In <https://github.com/rust-lang/rust/pull/126922>, the
`binary_asm_labels` lint was added which flags labels such as `0:` and
`1:`. Before that change, LLVM was giving a confusing error on
x86/x86_64 because of an incorrect interpretation.

However, targets other than x86 and x86_64 never had the error message
and have not been a problem. This means that the lint was causing code
that previously worked to start failing (e.g. `compiler_builtins`),
rather than only providing a more clear messages where there has always
been an error.

Adjust the lint to only fire on x86 and x86_64 assembly to avoid this
regression.
2024-07-18 15:00:56 -05:00

18 lines
353 B
Rust

//@ build-pass
//@ only-aarch64
// The `binary_asm_labels` lint should only be raised on `x86`. Make sure it
// doesn't get raised on other platforms.
use std::arch::asm;
fn main() {
unsafe {
asm!("0: bl 0b");
asm!("1: bl 1b");
asm!("10: bl 10b");
asm!("01: bl 01b");
asm!("1001101: bl 1001101b");
}
}