mirror of
https://github.com/rust-lang/rust
synced 2024-09-21 01:12:48 +00:00
20ca54b6a6
Improve escaping of byte, byte str, and c str proc-macro literals This PR changes the behavior of `proc_macro::Literal::byte_character` (https://github.com/rust-lang/rust/issues/115268), `byte_string`, and `c_string` (https://github.com/rust-lang/rust/issues/119750) to improve their choice of escape sequences. 3 categories of changes are made: 1. Never use `\x00`. Always prefer `\0`, which is supported in all the same places. 2. Never escape `\'` inside double quotes and `\"` inside single quotes. 3. Never use `\x` for valid UTF-8 in literals that permit `\u`. The second commit adds tests covering these cases, asserting the **old** behavior. The third commit implements the behavior change and simultaneously updates the tests to assert the **new** behavior. |
||
---|---|---|
.. | ||
alloc | ||
backtrace@72265bea21 | ||
core | ||
panic_abort | ||
panic_unwind | ||
portable-simd | ||
proc_macro | ||
profiler_builtins | ||
rtstartup | ||
rustc-std-workspace-alloc | ||
rustc-std-workspace-core | ||
rustc-std-workspace-std | ||
std | ||
stdarch@df3618d9f3 | ||
sysroot | ||
test | ||
unwind |