diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-01-24 16:00:10 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-01-25 12:28:11 +1100 |
| commit | 6be2e5623cb7ae63ca1796759150c0cbc845bbcd (patch) | |
| tree | 385273e4a49293e656be9fc737838eb68e3cc33d /compiler/rustc_parse/src/lexer/mod.rs | |
| parent | 86f371ed59e4172c9891bc9b976362a73689fb12 (diff) | |
| download | rust-6be2e5623cb7ae63ca1796759150c0cbc845bbcd.tar.gz rust-6be2e5623cb7ae63ca1796759150c0cbc845bbcd.zip | |
Use `unescape_unicode` for raw C string literals.
They can't contain `\x` escapes, which means they can't contain high bytes, which means we can used `unescape_unicode` instead of `unescape_mixed` to unescape them. This avoids unnecessary used of `MixedUnit`.
Diffstat (limited to 'compiler/rustc_parse/src/lexer/mod.rs')
| -rw-r--r-- | compiler/rustc_parse/src/lexer/mod.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/lexer/mod.rs b/compiler/rustc_parse/src/lexer/mod.rs index a491d1969bd..20ec4a300c1 100644 --- a/compiler/rustc_parse/src/lexer/mod.rs +++ b/compiler/rustc_parse/src/lexer/mod.rs @@ -472,7 +472,7 @@ impl<'sess, 'src> StringReader<'sess, 'src> { if let Some(n_hashes) = n_hashes { let n = u32::from(n_hashes); let kind = token::CStrRaw(n_hashes); - self.cook_mixed(kind, Mode::RawCStr, start, end, 3 + n, 1 + n) // cr##" "## + self.cook_unicode(kind, Mode::RawCStr, start, end, 3 + n, 1 + n) // cr##" "## } else { self.report_raw_str_error(start, 2); } |
