about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc/src/errors.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-06-14 12:23:35 +0200
committerGitHub <noreply@github.com>2024-06-14 12:23:35 +0200
commit20ca54b6a6bb735ddd0eb0ee8aa70d455e35ba18 (patch)
tree0c6dbbb13b95185a4d9e5986d97c029d4de2c311 /compiler/rustc_codegen_gcc/src/errors.rs
parentd2ad293851dc8e14a61355d0358490b77efae8cb (diff)
parent7ddc89e893ebb6c60af4fe92c439c4a60c9118dd (diff)
downloadrust-20ca54b6a6bb735ddd0eb0ee8aa70d455e35ba18.tar.gz
rust-20ca54b6a6bb735ddd0eb0ee8aa70d455e35ba18.zip
Rollup merge of #123769 - dtolnay:literal, r=fee1-dead
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.
Diffstat (limited to 'compiler/rustc_codegen_gcc/src/errors.rs')
0 files changed, 0 insertions, 0 deletions