Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ojeda opened this issue Aug 26, 2022 · 0 comments · Fixed by #101369
Closed
Labels
A-pretty Area: Pretty printing (including `-Z unpretty`) C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way.

Comments

@ojeda
Copy link
Contributor

ojeda commented Aug 26, 2022

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.

@ojeda ojeda added the C-bug Category: This is a bug. label Aug 26, 2022
@ojeda ojeda changed the title -Zunpretty=expanded output may not contain global_asm! depending on a comment -Zunpretty=expanded output may not contain global_asm! depending on comments/whitespace/... Aug 26, 2022
@bjorn3 bjorn3 added A-pretty Area: Pretty printing (including `-Z unpretty`) requires-nightly This issue requires a nightly compiler in some way. labels Aug 26, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Sep 3, 2022
… r=jackh726

Fix `global_asm` macro pretty printing

Fixes rust-lang#101051
Fixes rust-lang#101047
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-pretty Area: Pretty printing (including `-Z unpretty`) C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants