Skip to content

Commit 6938bfb

Browse files
committed
fix lint description and tweak user facing message
1 parent e1e8774 commit 6938bfb

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

compiler/rustc_lint/messages.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ lint_incomplete_include =
398398
lint_inner_macro_attribute_unstable = inner macro attributes are unstable
399399
400400
lint_invalid_asm_label_binary = avoid using labels containing only the digits `0` and `1` in inline assembly
401-
.help = use a different number that has at least one digit 2 or greater
401+
.label = use a different label that doesn't start with `0` or `1`
402402
.note = an LLVM bug makes these labels ambiguous with a binary literal number
403403
.note = see <https://bugs.llvm.org/show_bug.cgi?id=36144> for more information
404404

compiler/rustc_lint/src/builtin.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2815,7 +2815,7 @@ declare_lint! {
28152815
///
28162816
/// fn main() {
28172817
/// unsafe {
2818-
/// asm!("0: bar");
2818+
/// asm!("0: jmp 0b");
28192819
/// }
28202820
/// }
28212821
/// ```
@@ -2824,11 +2824,15 @@ declare_lint! {
28242824
///
28252825
/// ### Explanation
28262826
///
2827-
/// A bug in LLVM causes this code to fail
2827+
/// A [LLVM bug] causes this code to fail to compile because it interprets the `0b` as a binary
2828+
/// literal instead of a reference to the previous local label `0`. Note that even though the
2829+
/// bug is marked as fixed, it only fixes a specific usage of intel syntax within standalone
2830+
/// files, not inline assembly. To work around this bug, don't use labels that could be
2831+
/// confused with a binary literal.
28282832
///
28292833
/// See the explanation in [Rust By Example] for more details.
28302834
///
2831-
/// [local labels]: https://sourceware.org/binutils/docs/as/Symbol-Names.html#Local-Labels
2835+
/// [LLVM bug]: https://bugs.llvm.org/show_bug.cgi?id=36144
28322836
/// [Rust By Example]: https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels
28332837
pub BINARY_ASM_LABELS,
28342838
Deny,

0 commit comments

Comments
 (0)