about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc/example/std_example.rs
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-04-04 20:41:30 +0200
committerGitHub <noreply@github.com>2022-04-04 20:41:30 +0200
commit2d1496a8f62afb3ff3b7e4233c2eb65593d89780 (patch)
treebf97266ddece38bd6f7f9f1778664c1e9407e6bd /compiler/rustc_codegen_gcc/example/std_example.rs
parent98168925f6570a8d0292abd493cf20bde89c7663 (diff)
parentf383134acc48c97bbf2389aa62d51b9a51535482 (diff)
downloadrust-2d1496a8f62afb3ff3b7e4233c2eb65593d89780.tar.gz
rust-2d1496a8f62afb3ff3b7e4233c2eb65593d89780.zip
Rollup merge of #95343 - dtolnay:literals, r=petrochenkov
Reduce unnecessary escaping in proc_macro::Literal::character/string

I noticed that https://doc.rust-lang.org/proc_macro/struct.Literal.html#method.character is producing unreadable literals that make macro-expanded code unnecessarily hard to read. Since the proc macro server was using `escape_unicode()`, every char is escaped using `\u{…}` regardless of whether there is any need to do so. For example `Literal::character('=')` would previously produce `'\u{3d}'` which unnecessarily obscures the meaning when reading the macro-expanded code.

I've changed Literal::string also in this PR because `str`'s `Debug` impl is also smarter than just calling `escape_debug` on every char. For example `Literal::string("ferris's")` would previously produce `"ferris\'s"` but will now produce `"ferris's"`.
Diffstat (limited to 'compiler/rustc_codegen_gcc/example/std_example.rs')
0 files changed, 0 insertions, 0 deletions