@@ -55,7 +55,7 @@ use std::{error, fmt};
55
55
pub use diagnostic:: { Diagnostic , Level , MultiSpan } ;
56
56
#[ unstable( feature = "proc_macro_value" , issue = "136652" ) ]
57
57
pub use rustc_literal_escaper:: EscapeError ;
58
- use rustc_literal_escaper:: { MixedUnit , Mode , byte_from_char , unescape_mixed , unescape_unicode } ;
58
+ use rustc_literal_escaper:: { MixedUnit , unescape_byte_str , unescape_c_str , unescape_str } ;
59
59
#[ unstable( feature = "proc_macro_totokens" , issue = "130977" ) ]
60
60
pub use to_tokens:: ToTokens ;
61
61
@@ -1439,10 +1439,9 @@ impl Literal {
1439
1439
// Force-inlining here is aggressive but the closure is
1440
1440
// called on every char in the string, so it can be hot in
1441
1441
// programs with many long strings containing escapes.
1442
- unescape_unicode (
1442
+ unescape_str (
1443
1443
symbol,
1444
- Mode :: Str ,
1445
- & mut #[ inline ( always) ]
1444
+ #[ inline( always) ]
1446
1445
|_, c| match c {
1447
1446
Ok ( c) => buf. push ( c) ,
1448
1447
Err ( err) => {
@@ -1471,7 +1470,7 @@ impl Literal {
1471
1470
let mut error = None ;
1472
1471
let mut buf = Vec :: with_capacity ( symbol. len ( ) ) ;
1473
1472
1474
- unescape_mixed ( symbol, Mode :: CStr , & mut |_span, c| match c {
1473
+ unescape_c_str ( symbol, |_span, c| match c {
1475
1474
Ok ( MixedUnit :: Char ( c) ) => {
1476
1475
buf. extend_from_slice ( c. encode_utf8 ( & mut [ 0 ; 4 ] ) . as_bytes ( ) )
1477
1476
}
@@ -1510,8 +1509,8 @@ impl Literal {
1510
1509
let mut buf = Vec :: with_capacity ( symbol. len ( ) ) ;
1511
1510
let mut error = None ;
1512
1511
1513
- unescape_unicode ( symbol, Mode :: ByteStr , & mut |_, c | match c {
1514
- Ok ( c ) => buf. push ( byte_from_char ( c ) ) ,
1512
+ unescape_byte_str ( symbol, |_, res | match res {
1513
+ Ok ( b ) => buf. push ( b ) ,
1515
1514
Err ( err) => {
1516
1515
if err. is_fatal ( ) {
1517
1516
error = Some ( ConversionErrorKind :: FailedToUnescape ( err) ) ;
0 commit comments