-Z unpretty=expanded
leads to invalid syntax for unicode escapes in format strings
#116799
Labels
C-bug
Category: This is a bug.
E-medium
Call for participation: Medium difficulty. Experience needed to fix: Intermediate.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I tried this code (Godbolt link):
I expected to see this happen: When running
rustc -Z unpretty=expanded
, the format string literals for the first twoprintln!
s should remain valid string literals.Instead, this happened: This code is generated:
Note the double
{{
and}}
in the\u
escapes.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.Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: