@@ -2740,8 +2740,9 @@ declare_lint! {
2740
2740
///
2741
2741
/// ### Example
2742
2742
///
2743
- /// ```rust,compile_fail
2744
- /// # #![feature(asm_experimental_arch)]
2743
+ /// ```rust,ignore (fails on non-x86_64)
2744
+ /// #![cfg(target_arch = "x86_64")]
2745
+ ///
2745
2746
/// use std::arch::asm;
2746
2747
///
2747
2748
/// fn main() {
@@ -2751,19 +2752,32 @@ declare_lint! {
2751
2752
/// }
2752
2753
/// ```
2753
2754
///
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
+ /// ```
2755
2769
///
2756
2770
/// ### Explanation
2757
2771
///
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 .
2763
2777
///
2764
2778
/// See the explanation in [Rust By Example] for more details.
2765
2779
///
2766
- /// [LLVM bug]: https://bugs. llvm.org/show_bug.cgi?id=36144
2780
+ /// [LLVM bug]: https://github.com/ llvm/llvm-project/issues/99547
2767
2781
/// [Rust By Example]: https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels
2768
2782
pub BINARY_ASM_LABELS ,
2769
2783
Deny ,
0 commit comments