update to literal-escaper-0.0.5

This commit is contained in:
Marijn Schouten
2025-07-08 10:16:44 +00:00
parent 2783fc43fd
commit d44dcd4513
10 changed files with 16 additions and 16 deletions

View File

@@ -3260,9 +3260,9 @@ checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
[[package]]
name = "rustc-literal-escaper"
version = "0.0.4"
version = "0.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab03008eb631b703dd16978282ae36c73282e7922fe101a4bd072a40ecea7b8b"
checksum = "e4ee29da77c5a54f42697493cd4c9b9f31b74df666a6c04dfc4fde77abe0438b"
[[package]]
name = "rustc-main"

View File

@@ -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" }

View File

@@ -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")
}

View File

@@ -6,7 +6,7 @@ edition = "2024"
[dependencies]
# tidy-alphabetical-start
bitflags = "2.4.1"
rustc-literal-escaper = "0.0.4"
rustc-literal-escaper = "0.0.5"
rustc_ast = { path = "../rustc_ast" }
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
rustc_data_structures = { path = "../rustc_data_structures" }

View File

@@ -5,7 +5,7 @@ edition = "2024"
[dependencies]
# tidy-alphabetical-start
rustc-literal-escaper = "0.0.4"
rustc-literal-escaper = "0.0.5"
rustc_lexer = { path = "../rustc_lexer" }
# tidy-alphabetical-end

View File

@@ -15,7 +15,7 @@ test = false
doctest = false
[dependencies]
rustc-literal-escaper = "0.0.4"
rustc-literal-escaper = "0.0.5"
[features]
rustc-dep-of-std = []

View File

@@ -271,9 +271,9 @@ dependencies = [
[[package]]
name = "rustc-literal-escaper"
version = "0.0.4"
version = "0.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab03008eb631b703dd16978282ae36c73282e7922fe101a4bd072a40ecea7b8b"
checksum = "e4ee29da77c5a54f42697493cd4c9b9f31b74df666a6c04dfc4fde77abe0438b"
dependencies = [
"rustc-std-workspace-core",
"rustc-std-workspace-std",

View File

@@ -9,7 +9,7 @@ std = { path = "../std" }
# `core` when resolving doc links. Without this line a different `core` will be
# loaded from sysroot causing duplicate lang items and other similar errors.
core = { path = "../core" }
rustc-literal-escaper = { version = "0.0.4", features = ["rustc-dep-of-std"] }
rustc-literal-escaper = { version = "0.0.5", features = ["rustc-dep-of-std"] }
[features]
default = ["rustc-dep-of-std"]

View File

@@ -1471,11 +1471,11 @@ impl Literal {
let mut error = None;
let mut buf = Vec::with_capacity(symbol.len());
unescape_c_str(symbol, |_span, c| match c {
unescape_c_str(symbol, |_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) => {
if err.is_fatal() {
error = Some(ConversionErrorKind::FailedToUnescape(err));

View File

@@ -7,7 +7,7 @@ description = "A script to extract the lint documentation for the rustc book."
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
rustc-literal-escaper = "0.0.4"
rustc-literal-escaper = "0.0.5"
serde_json = "1.0.57"
tempfile = "3.1.0"
walkdir = "2.3.1"