mirror of
https://github.com/rust-lang/rust
synced 2024-09-30 05:40:24 +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. |
||
---|---|---|
.. | ||
assembly | ||
auxiliary | ||
codegen | ||
codegen-units | ||
coverage | ||
coverage-run-rustdoc | ||
crashes | ||
debuginfo | ||
incremental | ||
mir-opt | ||
pretty | ||
run-make | ||
run-pass-valgrind | ||
rustdoc | ||
rustdoc-gui | ||
rustdoc-js | ||
rustdoc-js-std | ||
rustdoc-json | ||
rustdoc-ui | ||
ui | ||
ui-fulldeps | ||
COMPILER_TESTS.md |