File tree 4 files changed +8
-7
lines changed
compile-fail-fulldeps/proc-macro/auxiliary
run-pass-fulldeps/auxiliary
4 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -755,6 +755,7 @@ impl Term {
755
755
}
756
756
}
757
757
758
+ // FIXME: Remove this, do not stabilize
758
759
/// Get a reference to the interned string.
759
760
#[ unstable( feature = "proc_macro" , issue = "38356" ) ]
760
761
pub fn as_str ( & self ) -> & str {
@@ -779,7 +780,7 @@ impl Term {
779
780
#[ unstable( feature = "proc_macro" , issue = "38356" ) ]
780
781
impl fmt:: Display for Term {
781
782
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
782
- self . as_str ( ) . fmt ( f)
783
+ self . sym . as_str ( ) . fmt ( f)
783
784
}
784
785
}
785
786
@@ -1176,7 +1177,7 @@ impl TokenTree {
1176
1177
} ,
1177
1178
self :: TokenTree :: Term ( tt) => {
1178
1179
let ident = ast:: Ident :: new ( tt. sym , tt. span . 0 ) ;
1179
- let sym_str = tt. sym . as_str ( ) ;
1180
+ let sym_str = tt. sym . to_string ( ) ;
1180
1181
let token = if sym_str. starts_with ( "'" ) {
1181
1182
Lifetime ( ident)
1182
1183
} else if sym_str. starts_with ( "r#" ) {
Original file line number Diff line number Diff line change @@ -183,7 +183,7 @@ impl Quote for Op {
183
183
184
184
impl Quote for Term {
185
185
fn quote ( self ) -> TokenStream {
186
- quote ! ( :: Term :: new( ( quote self . as_str( ) ) , ( quote self . span( ) ) ) )
186
+ quote ! ( :: Term :: new( ( quote self . sym . as_str( ) ) , ( quote self . span( ) ) ) )
187
187
}
188
188
}
189
189
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ fn assert_doc(slice: &mut &[TokenTree]) {
86
86
}
87
87
88
88
match & tokens[ 0 ] {
89
- TokenTree :: Term ( tt) => assert_eq ! ( "doc" , tt. as_str ( ) ) ,
89
+ TokenTree :: Term ( tt) => assert_eq ! ( "doc" , & * tt. to_string ( ) ) ,
90
90
_ => panic ! ( "expected `doc`" ) ,
91
91
}
92
92
match & tokens[ 1 ] {
@@ -118,11 +118,11 @@ fn assert_invoc(slice: &mut &[TokenTree]) {
118
118
119
119
fn assert_foo ( slice : & mut & [ TokenTree ] ) {
120
120
match & slice[ 0 ] {
121
- TokenTree :: Term ( tt) => assert_eq ! ( tt. as_str ( ) , "fn" ) ,
121
+ TokenTree :: Term ( tt) => assert_eq ! ( & * tt. to_string ( ) , "fn" ) ,
122
122
_ => panic ! ( "expected fn" ) ,
123
123
}
124
124
match & slice[ 1 ] {
125
- TokenTree :: Term ( tt) => assert_eq ! ( tt. as_str ( ) , "foo" ) ,
125
+ TokenTree :: Term ( tt) => assert_eq ! ( & * tt. to_string ( ) , "foo" ) ,
126
126
_ => panic ! ( "expected foo" ) ,
127
127
}
128
128
match & slice[ 2 ] {
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ pub fn cond(input: TokenStream) -> TokenStream {
33
33
panic ! ( "Invalid macro usage in cond: {}" , cond) ;
34
34
}
35
35
let is_else = match test {
36
- TokenTree :: Term ( word) => word. as_str ( ) == "else" ,
36
+ TokenTree :: Term ( word) => & * word. to_string ( ) == "else" ,
37
37
_ => false ,
38
38
} ;
39
39
conds. push ( if is_else || input. peek ( ) . is_none ( ) {
You can’t perform that action at this time.
0 commit comments