rust/compiler/rustc_lint
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
..
src Rollup merge of #126922 - asquared31415:asm_binary_label, r=estebank 2024-07-12 13:47:05 -07:00
Cargo.toml non_local_defs: point to Self and Trait to give more context 2024-05-27 23:59:18 +02:00
messages.ftl Rollup merge of #126922 - asquared31415:asm_binary_label, r=estebank 2024-07-12 13:47:05 -07:00