diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-04-04 20:41:30 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-04 20:41:30 +0200 |
| commit | 2d1496a8f62afb3ff3b7e4233c2eb65593d89780 (patch) | |
| tree | bf97266ddece38bd6f7f9f1778664c1e9407e6bd /compiler/rustc_codegen_gcc/example/std_example.rs | |
| parent | 98168925f6570a8d0292abd493cf20bde89c7663 (diff) | |
| parent | f383134acc48c97bbf2389aa62d51b9a51535482 (diff) | |
| download | rust-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
