a.rsi This generates lines ...">

-Zunpretty=expanded output may not contain global_asm! depending on comments/whitespace/... · Issue #101051 · rust-lang/rust (original) (raw)

Consider:

core::arch::global_asm!("x: .byte 42"); //

(Note: the // line is important)

RUSTC_BOOTSTRAP=1 rustc --edition=2021 --crate-type rlib -Zunpretty=expanded a.rs > a.rsi

This generates lines like:

global_asm! ("x: .byte 42") //

(See related issue #101047 for the lack of semicolon and path).

However, removing the comment line:

core::arch::global_asm!("x: .byte 42");

Makes the global_asm! disappear in the output.

I have also observed similar problems with whitespace, e.g.:

core::arch::global_asm!(r#"
        .globl f
        f:
            ret
"#);

vs.

core::arch::global_asm!(r#" .globl f f: ret "#);

Meta

Reproduces in both stable (1.63.0) and nightly.