diff options
| author | Marijn Schouten <mhkbst@gmail.com> | 2025-03-07 11:17:39 +0000 |
|---|---|---|
| committer | Marijn Schouten <mhkbst@gmail.com> | 2025-06-23 06:36:22 +0000 |
| commit | 707a6f54631c322e8c8ccff363fe024d67d93aa2 (patch) | |
| tree | 3c3069e7ac8e66e87f9661e083beb4020fffcd6a /compiler/rustc_parse_format | |
| parent | 68ac5abb067806a88464ddbfbd3c7eec877b488d (diff) | |
| download | rust-707a6f54631c322e8c8ccff363fe024d67d93aa2.tar.gz rust-707a6f54631c322e8c8ccff363fe024d67d93aa2.zip | |
update to literal-escaper 0.0.4 for better API without `unreachable` and faster string parsing
Diffstat (limited to 'compiler/rustc_parse_format')
| -rw-r--r-- | compiler/rustc_parse_format/Cargo.toml | 2 | ||||
| -rw-r--r-- | compiler/rustc_parse_format/src/lib.rs | 3 |
2 files changed, 2 insertions, 3 deletions
diff --git a/compiler/rustc_parse_format/Cargo.toml b/compiler/rustc_parse_format/Cargo.toml index 52f23c00d4b..0666ae29409 100644 --- a/compiler/rustc_parse_format/Cargo.toml +++ b/compiler/rustc_parse_format/Cargo.toml @@ -5,7 +5,7 @@ edition = "2024" [dependencies] # tidy-alphabetical-start -rustc-literal-escaper = "0.0.2" +rustc-literal-escaper = "0.0.4" rustc_lexer = { path = "../rustc_lexer" } # tidy-alphabetical-end diff --git a/compiler/rustc_parse_format/src/lib.rs b/compiler/rustc_parse_format/src/lib.rs index 42bd0f5d847..8e4da7923fc 100644 --- a/compiler/rustc_parse_format/src/lib.rs +++ b/compiler/rustc_parse_format/src/lib.rs @@ -20,7 +20,6 @@ use std::ops::Range; pub use Alignment::*; pub use Count::*; pub use Position::*; -use rustc_literal_escaper::{Mode, unescape_unicode}; /// The type of format string that we are parsing. #[derive(Copy, Clone, Debug, Eq, PartialEq)] @@ -320,7 +319,7 @@ impl<'input> Parser<'input> { let without_quotes = &snippet[1..snippet.len() - 1]; let (mut ok, mut vec) = (true, vec![]); let mut chars = input.chars(); - unescape_unicode(without_quotes, Mode::Str, &mut |range, res| match res { + rustc_literal_escaper::unescape_str(without_quotes, |range, res| match res { Ok(ch) if ok && chars.next().is_some_and(|c| ch == c) => { vec.push((range, ch)); } |
