Feature request: proc_macro with content as string
Rust Internals [Unofficial]
March 6, 2026
johanmattsson:
> Formatting can still be done on some macro bodies but not on the ones that care about white space.
Rustfmt has no way to know if a macro invocation is for a macro that cares about whitespace. Knowing that requires doing name resolution and macro expansion, both of which are impossible for rustfmt as it works on individual files and doesn't have access to crate metadata for dependencies.
Discussion in the ATmosphere