Skip to content

-Zunpretty=expanded output may not contain global_asm! depending on comments/whitespace/... #101051

Closed
@ojeda

Description

@ojeda

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-prettyArea: Pretty printing (including `-Z unpretty`)C-bugCategory: This is a bug.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions