rust/tests/ui/asm
Jubilee fc0136e4f4
Rollup merge of #126922 - asquared31415:asm_binary_label, r=estebank
add lint for inline asm labels that look like binary

fixes #94426

Due to a bug/feature in LLVM, labels composed of only the digits `0` and `1` can sometimes be confused with binary literals, even if a binary literal would not be valid in that position.

This PR adds detection for such labels and also as a drive-by change, adds a note to cases such as `asm!(include_str!("file"))` that the label that it found came from an expansion of a macro, it wasn't found in the source code.

I expect this PR to upset some people that were using labels `0:` or `1:` without issue because they never hit the case where LLVM got it wrong, but adding a heuristic to the lint to prevent this is not feasible - it would involve writing a whole assembly parser for every target that we have assembly support for.

[zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202024-06-20/near/445870628)

r? ``@estebank``
2024-07-12 13:47:05 -07:00
..
aarch64 Fix aarch64 test 2024-07-11 20:40:02 +00:00
x86_64 Account for let foo = expr; to suggest const foo: Ty = expr; 2024-07-11 20:39:24 +00:00
arm-low-dreg.rs compiler: Fix arm32 asm issues by hierarchically sorting reg classes 2024-06-22 21:39:58 -07:00
bad-arch.rs
bad-arch.stderr
bad-template.aarch64.stderr
bad-template.rs
bad-template.x86_64.stderr
binary_asm_labels.rs add lint for inline asm labels that look like binary 2024-07-09 01:23:49 +00:00
binary_asm_labels.stderr add lint for inline asm labels that look like binary 2024-07-09 01:23:49 +00:00
const-error.rs
const-error.stderr
empty_global_asm.rs
fail-const-eval-issue-121099.rs
fail-const-eval-issue-121099.stderr
generic-const.rs
inline-syntax.arm_llvm_18.stderr
inline-syntax.arm.stderr
inline-syntax.rs
inline-syntax.x86_64.stderr
issue-72570.rs
issue-72570.stderr
issue-85247.rs
issue-85247.rwpi.stderr
issue-87802.rs
issue-87802.stderr
issue-89305.rs
issue-89305.stderr
issue-92378.rs
issue-97490.rs
issue-99071.rs
issue-99071.stderr
issue-99122-2.rs
issue-99122.rs
issue-99122.stderr
issue-113788.rs
issue-113788.stderr
may_unwind.rs
naked-functions-ffi.rs
naked-functions-ffi.stderr
naked-functions-unused.aarch64.stderr
naked-functions-unused.rs
naked-functions-unused.x86_64.stderr
naked-functions.rs
naked-functions.stderr
naked-invalid-attr.rs
naked-invalid-attr.stderr
named-asm-labels.rs add lint for inline asm labels that look like binary 2024-07-09 01:23:49 +00:00
named-asm-labels.s
named-asm-labels.stderr add lint for inline asm labels that look like binary 2024-07-09 01:23:49 +00:00
noreturn.rs
parse-error.rs
parse-error.stderr Account for let foo = expr; to suggest const foo: Ty = expr; 2024-07-11 20:39:24 +00:00
reg-conflict.rs
reg-conflict.stderr
simple_global_asm.rs
type-check-1.rs
type-check-1.stderr Account for let foo = expr; to suggest const foo: Ty = expr; 2024-07-11 20:39:24 +00:00
type-check-4.rs
type-check-4.stderr
unpretty-expanded.rs
unpretty-expanded.stdout