diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-07-17 10:41:45 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-17 10:41:45 +0200 |
| commit | 465ae9432812040a80b7c22c5a1c020663757e0f (patch) | |
| tree | 0acf907bb6846c84ac3de660750d0046ea06e235 /compiler/rustc_ast | |
| parent | 52a405b6c98d02d64562f2b602e8f6a29aebca5b (diff) | |
| parent | d44dcd451326d32516c22ee5f998304afaf19c4d (diff) | |
| download | rust-465ae9432812040a80b7c22c5a1c020663757e0f.tar.gz rust-465ae9432812040a80b7c22c5a1c020663757e0f.zip | |
Rollup merge of #143631 - hkBst:update-escaper-2, r=compiler-errors
update to literal-escaper-0.0.5 Quoting from the changelog, this version brings: - Use `NonZero<char/u8>` in `unescape_c_str` and `check_raw_c_str` to statically exclude nuls - Add `#[inline]` to small functions for improved performance
Diffstat (limited to 'compiler/rustc_ast')
| -rw-r--r-- | compiler/rustc_ast/Cargo.toml | 2 | ||||
| -rw-r--r-- | compiler/rustc_ast/src/util/literal.rs | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_ast/Cargo.toml b/compiler/rustc_ast/Cargo.toml index 5de2e69072f..155e14a3796 100644 --- a/compiler/rustc_ast/Cargo.toml +++ b/compiler/rustc_ast/Cargo.toml @@ -7,7 +7,7 @@ edition = "2024" # tidy-alphabetical-start bitflags = "2.4.1" memchr = "2.7.4" -rustc-literal-escaper = "0.0.4" +rustc-literal-escaper = "0.0.5" rustc_ast_ir = { path = "../rustc_ast_ir" } rustc_data_structures = { path = "../rustc_data_structures" } rustc_index = { path = "../rustc_index" } diff --git a/compiler/rustc_ast/src/util/literal.rs b/compiler/rustc_ast/src/util/literal.rs index fa7878873e5..2dfd695d880 100644 --- a/compiler/rustc_ast/src/util/literal.rs +++ b/compiler/rustc_ast/src/util/literal.rs @@ -126,11 +126,11 @@ impl LitKind { token::CStr => { let s = symbol.as_str(); let mut buf = Vec::with_capacity(s.len()); - unescape_c_str(s, |_span, c| match c { + unescape_c_str(s, |_span, res| match res { Ok(MixedUnit::Char(c)) => { - buf.extend_from_slice(c.encode_utf8(&mut [0; 4]).as_bytes()) + buf.extend_from_slice(c.get().encode_utf8(&mut [0; 4]).as_bytes()) } - Ok(MixedUnit::HighByte(b)) => buf.push(b), + Ok(MixedUnit::HighByte(b)) => buf.push(b.get()), Err(err) => { assert!(!err.is_fatal(), "failed to unescape C string literal") } |
