Fix copy/paste error.

The `CString` handling code is erroneously identical to the `ByteString`
handling code.
This commit is contained in:
Nicholas Nethercote 2024-01-24 16:46:57 +11:00
parent 314dbc7f22
commit 4b4bdb575b

View File

@ -5,7 +5,7 @@
mod block; mod block;
use rowan::Direction; use rowan::Direction;
use rustc_lexer::unescape::{self, unescape_literal, Mode}; use rustc_lexer::unescape::{self, unescape_c_string, unescape_literal, Mode};
use crate::{ use crate::{
algo, algo,
@ -162,7 +162,7 @@ fn unquote(text: &str, prefix_len: usize, end_delimiter: char) -> Option<&str> {
ast::LiteralKind::CString(s) => { ast::LiteralKind::CString(s) => {
if !s.is_raw() { if !s.is_raw() {
if let Some(without_quotes) = unquote(text, 2, '"') { if let Some(without_quotes) = unquote(text, 2, '"') {
unescape_literal(without_quotes, Mode::ByteStr, &mut |range, char| { unescape_c_string(without_quotes, Mode::CStr, &mut |range, char| {
if let Err(err) = char { if let Err(err) = char {
push_err(1, range.start, err); push_err(1, range.start, err);
} }