31
31
#![ feature( restricted_std) ]
32
32
#![ feature( rustc_attrs) ]
33
33
#![ feature( min_specialization) ]
34
+ #![ feature( spec_to_string) ]
34
35
#![ recursion_limit = "256" ]
35
36
36
37
#[ unstable( feature = "proc_macro_internals" , issue = "27812" ) ]
@@ -46,6 +47,7 @@ use std::cmp::Ordering;
46
47
use std:: ops:: RangeBounds ;
47
48
use std:: path:: PathBuf ;
48
49
use std:: str:: FromStr ;
50
+ use std:: string:: SpecToString ;
49
51
use std:: { error, fmt, iter, mem} ;
50
52
51
53
/// Determines whether proc_macro has been made accessible to the currently
@@ -141,9 +143,9 @@ impl FromStr for TokenStream {
141
143
142
144
// N.B., the bridge only provides `to_string`, implement `fmt::Display`
143
145
// 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 {
147
149
self . 0 . to_string ( )
148
150
}
149
151
}
@@ -624,9 +626,9 @@ impl From<Literal> for TokenTree {
624
626
625
627
// N.B., the bridge only provides `to_string`, implement `fmt::Display`
626
628
// 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 {
630
632
match * self {
631
633
TokenTree :: Group ( ref t) => t. to_string ( ) ,
632
634
TokenTree :: Ident ( ref t) => t. to_string ( ) ,
@@ -754,9 +756,9 @@ impl Group {
754
756
755
757
// N.B., the bridge only provides `to_string`, implement `fmt::Display`
756
758
// 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 {
760
762
TokenStream :: from ( TokenTree :: from ( self . clone ( ) ) ) . to_string ( )
761
763
}
762
764
}
@@ -854,9 +856,9 @@ impl Punct {
854
856
855
857
// N.B., the bridge only provides `to_string`, implement `fmt::Display`
856
858
// 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 {
860
862
TokenStream :: from ( TokenTree :: from ( self . clone ( ) ) ) . to_string ( )
861
863
}
862
864
}
@@ -935,7 +937,7 @@ impl Ident {
935
937
}
936
938
937
939
/// 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).
939
941
#[ stable( feature = "proc_macro_lib2" , since = "1.29.0" ) ]
940
942
pub fn span ( & self ) -> Span {
941
943
Span ( self . 0 . span ( ) )
@@ -950,9 +952,9 @@ impl Ident {
950
952
951
953
// N.B., the bridge only provides `to_string`, implement `fmt::Display`
952
954
// 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 {
956
958
TokenStream :: from ( TokenTree :: from ( self . clone ( ) ) ) . to_string ( )
957
959
}
958
960
}
@@ -1210,9 +1212,9 @@ impl FromStr for Literal {
1210
1212
1211
1213
// N.B., the bridge only provides `to_string`, implement `fmt::Display`
1212
1214
// 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 {
1216
1218
self . 0 . to_string ( )
1217
1219
}
1218
1220
}
0 commit comments