Skip to content

Commit

Permalink
fix lint description and tweak user facing message
Browse files Browse the repository at this point in the history
  • Loading branch information
asquared31415 committed Jun 29, 2024
1 parent e1e8774 commit 6938bfb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_lint/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ lint_incomplete_include =
lint_inner_macro_attribute_unstable = inner macro attributes are unstable
lint_invalid_asm_label_binary = avoid using labels containing only the digits `0` and `1` in inline assembly
.help = use a different number that has at least one digit 2 or greater
.label = use a different label that doesn't start with `0` or `1`
.note = an LLVM bug makes these labels ambiguous with a binary literal number
.note = see <https://bugs.llvm.org/show_bug.cgi?id=36144> for more information
Expand Down
10 changes: 7 additions & 3 deletions compiler/rustc_lint/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2815,7 +2815,7 @@ declare_lint! {
///
/// fn main() {
/// unsafe {
/// asm!("0: bar");
/// asm!("0: jmp 0b");
/// }
/// }
/// ```
Expand All @@ -2824,11 +2824,15 @@ declare_lint! {
///
/// ### Explanation
///
/// A bug in LLVM causes this code to fail
/// A [LLVM bug] causes this code to fail to compile because it interprets the `0b` as a binary
/// literal instead of a reference to the previous local label `0`. Note that even though the
/// bug is marked as fixed, it only fixes a specific usage of intel syntax within standalone
/// files, not inline assembly. To work around this bug, don't use labels that could be
/// confused with a binary literal.
///
/// See the explanation in [Rust By Example] for more details.
///
/// [local labels]: https://sourceware.org/binutils/docs/as/Symbol-Names.html#Local-Labels
/// [LLVM bug]: https://bugs.llvm.org/show_bug.cgi?id=36144
/// [Rust By Example]: https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels
pub BINARY_ASM_LABELS,
Deny,
Expand Down

0 comments on commit 6938bfb

Please sign in to comment.