@@ -55,7 +55,7 @@ use std::{error, fmt};
5555pub use diagnostic:: { Diagnostic , Level , MultiSpan } ;
5656#[ unstable( feature = "proc_macro_value" , issue = "136652" ) ]
5757pub 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 } ;
5959#[ unstable( feature = "proc_macro_totokens" , issue = "130977" ) ]
6060pub use to_tokens:: ToTokens ;
6161
@@ -1439,10 +1439,9 @@ impl Literal {
14391439 // Force-inlining here is aggressive but the closure is
14401440 // called on every char in the string, so it can be hot in
14411441 // programs with many long strings containing escapes.
1442- unescape_unicode (
1442+ unescape_str (
14431443 symbol,
1444- Mode :: Str ,
1445- & mut #[ inline ( always) ]
1444+ #[ inline( always) ]
14461445 |_, c| match c {
14471446 Ok ( c) => buf. push ( c) ,
14481447 Err ( err) => {
@@ -1471,7 +1470,7 @@ impl Literal {
14711470 let mut error = None ;
14721471 let mut buf = Vec :: with_capacity ( symbol. len ( ) ) ;
14731472
1474- unescape_mixed ( symbol, Mode :: CStr , & mut |_span, c| match c {
1473+ unescape_c_str ( symbol, |_span, c| match c {
14751474 Ok ( MixedUnit :: Char ( c) ) => {
14761475 buf. extend_from_slice ( c. encode_utf8 ( & mut [ 0 ; 4 ] ) . as_bytes ( ) )
14771476 }
@@ -1510,8 +1509,8 @@ impl Literal {
15101509 let mut buf = Vec :: with_capacity ( symbol. len ( ) ) ;
15111510 let mut error = None ;
15121511
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 ) ,
15151514 Err ( err) => {
15161515 if err. is_fatal ( ) {
15171516 error = Some ( ConversionErrorKind :: FailedToUnescape ( err) ) ;
0 commit comments