You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
-Z unpretty=expanded leads to invalid syntax for unicode escapes in format strings #116799
I expected to see this happen: When running rustc -Z unpretty=expanded, the format string literals for the first two println!s should remain valid string literals.
The escape sequences in the last println! are correctly preserved.
This is annoying because it makes it impossible to run rustfmt on the macro-expanded source, which is helpful when trying to read macro-generated code.
Activity
Noratrieb commentedon Oct 16, 2023
I haven't looked at it, but this is probably going wrong somewhere in
compiler/rustc_ast_prettywhen printingFormatArgs.narpfel commentedon Oct 16, 2023
Looks like you’re right:
rust/compiler/rustc_ast_pretty/src/pprust/state/expr.rs
Lines 686 to 693 in e7bdc5f
As I understand this, it duplicates curlies regardless of whether they’re part of an escape sequence.
narpfel commentedon Oct 16, 2023
@rustbot claim
Rollup merge of rust-lang#116811 - narpfel:unpretty-unicode-escape-in…
Unrolled build for rust-lang#116811