3131#![ feature( restricted_std) ]
3232#![ feature( rustc_attrs) ]
3333#![ feature( min_specialization) ]
34+ #![ feature( spec_to_string) ]
3435#![ recursion_limit = "256" ]
3536
3637#[ unstable( feature = "proc_macro_internals" , issue = "27812" ) ]
@@ -46,6 +47,7 @@ use std::cmp::Ordering;
4647use std:: ops:: RangeBounds ;
4748use std:: path:: PathBuf ;
4849use std:: str:: FromStr ;
50+ use std:: string:: SpecToString ;
4951use std:: { error, fmt, iter, mem} ;
5052
5153/// Determines whether proc_macro has been made accessible to the currently
@@ -141,9 +143,9 @@ impl FromStr for TokenStream {
141143
142144// N.B., the bridge only provides `to_string`, implement `fmt::Display`
143145// based on it (the reverse of the usual relationship between the two).
144- #[ stable ( feature = "proc_macro_lib " , since = "1.15.0 " ) ]
145- impl ToString for TokenStream {
146- fn to_string ( & self ) -> String {
146+ #[ unstable ( issue = "none " , feature = "spec_to_string " ) ]
147+ impl SpecToString for TokenStream {
148+ fn spec_to_string ( & self ) -> String {
147149 self . 0 . to_string ( )
148150 }
149151}
@@ -624,9 +626,9 @@ impl From<Literal> for TokenTree {
624626
625627// N.B., the bridge only provides `to_string`, implement `fmt::Display`
626628// based on it (the reverse of the usual relationship between the two).
627- #[ stable ( feature = "proc_macro_lib " , since = "1.15.0 " ) ]
628- impl ToString for TokenTree {
629- fn to_string ( & self ) -> String {
629+ #[ unstable ( issue = "none " , feature = "spec_to_string " ) ]
630+ impl SpecToString for TokenTree {
631+ fn spec_to_string ( & self ) -> String {
630632 match * self {
631633 TokenTree :: Group ( ref t) => t. to_string ( ) ,
632634 TokenTree :: Ident ( ref t) => t. to_string ( ) ,
@@ -754,9 +756,9 @@ impl Group {
754756
755757// N.B., the bridge only provides `to_string`, implement `fmt::Display`
756758// based on it (the reverse of the usual relationship between the two).
757- #[ stable ( feature = "proc_macro_lib " , since = "1.15.0 " ) ]
758- impl ToString for Group {
759- fn to_string ( & self ) -> String {
759+ #[ unstable ( issue = "none " , feature = "spec_to_string " ) ]
760+ impl SpecToString for Group {
761+ fn spec_to_string ( & self ) -> String {
760762 TokenStream :: from ( TokenTree :: from ( self . clone ( ) ) ) . to_string ( )
761763 }
762764}
@@ -854,9 +856,9 @@ impl Punct {
854856
855857// N.B., the bridge only provides `to_string`, implement `fmt::Display`
856858// based on it (the reverse of the usual relationship between the two).
857- #[ stable ( feature = "proc_macro_lib " , since = "1.15.0 " ) ]
858- impl ToString for Punct {
859- fn to_string ( & self ) -> String {
859+ #[ unstable ( issue = "none " , feature = "spec_to_string " ) ]
860+ impl SpecToString for Punct {
861+ fn spec_to_string ( & self ) -> String {
860862 TokenStream :: from ( TokenTree :: from ( self . clone ( ) ) ) . to_string ( )
861863 }
862864}
@@ -935,7 +937,7 @@ impl Ident {
935937 }
936938
937939 /// Returns the span of this `Ident`, encompassing the entire string returned
938- /// by [`to_string`](Self ::to_string).
940+ /// by [`to_string`](ToString ::to_string).
939941 #[ stable( feature = "proc_macro_lib2" , since = "1.29.0" ) ]
940942 pub fn span ( & self ) -> Span {
941943 Span ( self . 0 . span ( ) )
@@ -950,9 +952,9 @@ impl Ident {
950952
951953// N.B., the bridge only provides `to_string`, implement `fmt::Display`
952954// based on it (the reverse of the usual relationship between the two).
953- #[ stable ( feature = "proc_macro_lib " , since = "1.15.0 " ) ]
954- impl ToString for Ident {
955- fn to_string ( & self ) -> String {
955+ #[ unstable ( issue = "none " , feature = "spec_to_string " ) ]
956+ impl SpecToString for Ident {
957+ fn spec_to_string ( & self ) -> String {
956958 TokenStream :: from ( TokenTree :: from ( self . clone ( ) ) ) . to_string ( )
957959 }
958960}
@@ -1210,9 +1212,9 @@ impl FromStr for Literal {
12101212
12111213// N.B., the bridge only provides `to_string`, implement `fmt::Display`
12121214// based on it (the reverse of the usual relationship between the two).
1213- #[ stable ( feature = "proc_macro_lib " , since = "1.15.0 " ) ]
1214- impl ToString for Literal {
1215- fn to_string ( & self ) -> String {
1215+ #[ unstable ( issue = "none " , feature = "spec_to_string " ) ]
1216+ impl SpecToString for Literal {
1217+ fn spec_to_string ( & self ) -> String {
12161218 self . 0 . to_string ( )
12171219 }
12181220}
0 commit comments