Skip to content

Commit 8b66164

Browse files
committed
Update the binary_asm_label documentation
Disable a test that now only passes on x86 and make the link point to the new (open) LLVM bug.
1 parent 8410348 commit 8b66164

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

compiler/rustc_lint/src/builtin.rs

+23-9
Original file line numberDiff line numberDiff line change
@@ -2740,8 +2740,9 @@ declare_lint! {
27402740
///
27412741
/// ### Example
27422742
///
2743-
/// ```rust,compile_fail
2744-
/// # #![feature(asm_experimental_arch)]
2743+
/// ```rust,ignore (fails on non-x86_64)
2744+
/// #![cfg(target_arch = "x86_64")]
2745+
///
27452746
/// use std::arch::asm;
27462747
///
27472748
/// fn main() {
@@ -2751,19 +2752,32 @@ declare_lint! {
27512752
/// }
27522753
/// ```
27532754
///
2754-
/// {{produces}}
2755+
/// This will produce:
2756+
///
2757+
/// ```text
2758+
/// error: avoid using labels containing only the digits `0` and `1` in inline assembly
2759+
/// --> <source>:7:15
2760+
/// |
2761+
/// 7 | asm!("0: jmp 0b");
2762+
/// | ^ use a different label that doesn't start with `0` or `1`
2763+
/// |
2764+
/// = help: start numbering with `2` instead
2765+
/// = note: an LLVM bug makes these labels ambiguous with a binary literal number on x86
2766+
/// = note: see <https://github.com/llvm/llvm-project/issues/99547> for more information
2767+
/// = note: `#[deny(binary_asm_labels)]` on by default
2768+
/// ```
27552769
///
27562770
/// ### Explanation
27572771
///
2758-
/// A [LLVM bug] causes this code to fail to compile because it interprets the `0b` as a binary
2759-
/// literal instead of a reference to the previous local label `0`. Note that even though the
2760-
/// bug is marked as fixed, it only fixes a specific usage of intel syntax within standalone
2761-
/// files, not inline assembly. To work around this bug, don't use labels that could be
2762-
/// confused with a binary literal.
2772+
/// Am [LLVM bug] causes this code to fail to compile because it interprets the `0b` as a binary
2773+
/// literal instead of a reference to the previous local label `0`. To work around this bug,
2774+
/// don't use labels that could be confused with a binary literal.
2775+
///
2776+
/// This behavior is platform-specific to x86 and x86-64.
27632777
///
27642778
/// See the explanation in [Rust By Example] for more details.
27652779
///
2766-
/// [LLVM bug]: https://bugs.llvm.org/show_bug.cgi?id=36144
2780+
/// [LLVM bug]: https://github.com/llvm/llvm-project/issues/99547
27672781
/// [Rust By Example]: https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels
27682782
pub BINARY_ASM_LABELS,
27692783
Deny,

0 commit comments

Comments
 (0)