-Zunpretty=expanded
output with global_asm!
loses semicolon thus cannot be formatted · Issue #101047 · rust-lang/rust (original) (raw)
Consider:
core::arch::global_asm!("x: .byte 42"); fn f() {}
(Note: the f
function is important to reproduce the issue, otherwise the output disappears: see #101051)
RUSTC_BOOTSTRAP=1 rustc --edition=2021 --crate-type rlib -Zunpretty=expanded a.rs > a.rsi rustfmt --edition=2021 --check a.rsi
This generates a line like:
global_asm! ("x: .byte 42")
Which cannot be formatted because:
error: macros that expand to items must be delimited with braces or followed by a semicolon --> a.rsi:6:13 | 6 | global_asm! ("x: .byte 42") | ^^^^^^^^^^^^^^^ | help: change the delimiters to curly braces | 6 | global_asm! {"x: .byte 42"} | ~ ~ help: add a semicolon | 6 | global_asm! ("x: .byte 42"); |
(It also loses the path to global_asm!
, but that is not required for formatting)
Meta
Reproduces in both stable (1.63.0) and nightly.