@@ -74,7 +74,7 @@ impl TokenStream {
74
74
#[ cfg( not( wrap_proc_macro) ) ]
75
75
inner: literal,
76
76
..
77
- } ) if literal. text . starts_with ( '-' ) => {
77
+ } ) if literal. repr . starts_with ( '-' ) => {
78
78
push_negative_literal ( self , literal) ;
79
79
}
80
80
#[ cfg( no_bind_by_move_pattern_guard) ]
@@ -85,7 +85,7 @@ impl TokenStream {
85
85
inner: literal,
86
86
..
87
87
} ) => {
88
- if literal. text . starts_with ( '-' ) {
88
+ if literal. repr . starts_with ( '-' ) {
89
89
push_negative_literal ( self , literal) ;
90
90
} else {
91
91
self . inner
@@ -97,7 +97,7 @@ impl TokenStream {
97
97
98
98
#[ cold]
99
99
fn push_negative_literal ( stream : & mut TokenStream , mut literal : Literal ) {
100
- literal. text . remove ( 0 ) ;
100
+ literal. repr . remove ( 0 ) ;
101
101
let mut punct = crate :: Punct :: new ( '-' , Spacing :: Alone ) ;
102
102
punct. set_span ( crate :: Span :: _new_stable ( literal. span ) ) ;
103
103
stream. inner . push ( TokenTree :: Punct ( punct) ) ;
@@ -756,7 +756,7 @@ impl Debug for Ident {
756
756
757
757
#[ derive( Clone ) ]
758
758
pub ( crate ) struct Literal {
759
- text : String ,
759
+ repr : String ,
760
760
span : Span ,
761
761
}
762
762
@@ -777,9 +777,9 @@ macro_rules! unsuffixed_numbers {
777
777
}
778
778
779
779
impl Literal {
780
- pub ( crate ) fn _new ( text : String ) -> Self {
780
+ pub ( crate ) fn _new ( repr : String ) -> Self {
781
781
Literal {
782
- text ,
782
+ repr ,
783
783
span : Span :: call_site ( ) ,
784
784
}
785
785
}
@@ -838,31 +838,31 @@ impl Literal {
838
838
}
839
839
840
840
pub fn string ( t : & str ) -> Literal {
841
- let mut text = String :: with_capacity ( t. len ( ) + 2 ) ;
842
- text . push ( '"' ) ;
841
+ let mut repr = String :: with_capacity ( t. len ( ) + 2 ) ;
842
+ repr . push ( '"' ) ;
843
843
for c in t. chars ( ) {
844
844
if c == '\'' {
845
845
// escape_debug turns this into "\'" which is unnecessary.
846
- text . push ( c) ;
846
+ repr . push ( c) ;
847
847
} else {
848
- text . extend ( c. escape_debug ( ) ) ;
848
+ repr . extend ( c. escape_debug ( ) ) ;
849
849
}
850
850
}
851
- text . push ( '"' ) ;
852
- Literal :: _new ( text )
851
+ repr . push ( '"' ) ;
852
+ Literal :: _new ( repr )
853
853
}
854
854
855
855
pub fn character ( t : char ) -> Literal {
856
- let mut text = String :: new ( ) ;
857
- text . push ( '\'' ) ;
856
+ let mut repr = String :: new ( ) ;
857
+ repr . push ( '\'' ) ;
858
858
if t == '"' {
859
859
// escape_debug turns this into '\"' which is unnecessary.
860
- text . push ( t) ;
860
+ repr . push ( t) ;
861
861
} else {
862
- text . extend ( t. escape_debug ( ) ) ;
862
+ repr . extend ( t. escape_debug ( ) ) ;
863
863
}
864
- text . push ( '\'' ) ;
865
- Literal :: _new ( text )
864
+ repr . push ( '\'' ) ;
865
+ Literal :: _new ( repr )
866
866
}
867
867
868
868
pub fn byte_string ( bytes : & [ u8 ] ) -> Literal {
@@ -910,9 +910,9 @@ impl FromStr for Literal {
910
910
}
911
911
let cursor = get_cursor ( repr) ;
912
912
if let Ok ( ( _rest, mut literal) ) = parse:: literal ( cursor) {
913
- if literal. text . len ( ) == repr. len ( ) {
913
+ if literal. repr . len ( ) == repr. len ( ) {
914
914
if negative {
915
- literal. text . insert ( 0 , '-' ) ;
915
+ literal. repr . insert ( 0 , '-' ) ;
916
916
}
917
917
return Ok ( literal) ;
918
918
}
@@ -923,14 +923,14 @@ impl FromStr for Literal {
923
923
924
924
impl Display for Literal {
925
925
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
926
- Display :: fmt ( & self . text , f)
926
+ Display :: fmt ( & self . repr , f)
927
927
}
928
928
}
929
929
930
930
impl Debug for Literal {
931
931
fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
932
932
let mut debug = fmt. debug_struct ( "Literal" ) ;
933
- debug. field ( "lit" , & format_args ! ( "{}" , self . text ) ) ;
933
+ debug. field ( "lit" , & format_args ! ( "{}" , self . repr ) ) ;
934
934
debug_span_field_if_nontrivial ( & mut debug, self . span ) ;
935
935
debug. finish ( )
936
936
}
0 commit comments