File tree Expand file tree Collapse file tree 4 files changed +8
-7
lines changed
compile-fail-fulldeps/proc-macro/auxiliary
run-pass-fulldeps/auxiliary Expand file tree Collapse file tree 4 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -755,6 +755,7 @@ impl Term {
755755 }
756756 }
757757
758+ // FIXME: Remove this, do not stabilize
758759 /// Get a reference to the interned string.
759760 #[ unstable( feature = "proc_macro" , issue = "38356" ) ]
760761 pub fn as_str ( & self ) -> & str {
@@ -779,7 +780,7 @@ impl Term {
779780#[ unstable( feature = "proc_macro" , issue = "38356" ) ]
780781impl fmt:: Display for Term {
781782 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
782- self . as_str ( ) . fmt ( f)
783+ self . sym . as_str ( ) . fmt ( f)
783784 }
784785}
785786
@@ -1176,7 +1177,7 @@ impl TokenTree {
11761177 } ,
11771178 self :: TokenTree :: Term ( tt) => {
11781179 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 ( ) ;
11801181 let token = if sym_str. starts_with ( "'" ) {
11811182 Lifetime ( ident)
11821183 } 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 {
183183
184184impl Quote for Term {
185185 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( ) ) ) )
187187 }
188188}
189189
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ fn assert_doc(slice: &mut &[TokenTree]) {
8686 }
8787
8888 match & tokens[ 0 ] {
89- TokenTree :: Term ( tt) => assert_eq ! ( "doc" , tt. as_str ( ) ) ,
89+ TokenTree :: Term ( tt) => assert_eq ! ( "doc" , & * tt. to_string ( ) ) ,
9090 _ => panic ! ( "expected `doc`" ) ,
9191 }
9292 match & tokens[ 1 ] {
@@ -118,11 +118,11 @@ fn assert_invoc(slice: &mut &[TokenTree]) {
118118
119119fn assert_foo ( slice : & mut & [ TokenTree ] ) {
120120 match & slice[ 0 ] {
121- TokenTree :: Term ( tt) => assert_eq ! ( tt. as_str ( ) , "fn" ) ,
121+ TokenTree :: Term ( tt) => assert_eq ! ( & * tt. to_string ( ) , "fn" ) ,
122122 _ => panic ! ( "expected fn" ) ,
123123 }
124124 match & slice[ 1 ] {
125- TokenTree :: Term ( tt) => assert_eq ! ( tt. as_str ( ) , "foo" ) ,
125+ TokenTree :: Term ( tt) => assert_eq ! ( & * tt. to_string ( ) , "foo" ) ,
126126 _ => panic ! ( "expected foo" ) ,
127127 }
128128 match & slice[ 2 ] {
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ pub fn cond(input: TokenStream) -> TokenStream {
3333 panic ! ( "Invalid macro usage in cond: {}" , cond) ;
3434 }
3535 let is_else = match test {
36- TokenTree :: Term ( word) => word. as_str ( ) == "else" ,
36+ TokenTree :: Term ( word) => & * word. to_string ( ) == "else" ,
3737 _ => false ,
3838 } ;
3939 conds. push ( if is_else || input. peek ( ) . is_none ( ) {
You can’t perform that action at this time.
0 commit comments