File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 4848#![ feature( placement_new_protocol) ]
4949#![ feature( shared) ]
5050#![ feature( slice_patterns) ]
51+ #![ feature( specialization) ]
5152#![ feature( staged_api) ]
5253#![ feature( step_by) ]
5354#![ feature( str_char) ]
Original file line number Diff line number Diff line change @@ -1770,7 +1770,7 @@ pub trait ToString {
17701770#[ stable( feature = "rust1" , since = "1.0.0" ) ]
17711771impl < T : fmt:: Display + ?Sized > ToString for T {
17721772 #[ inline]
1773- fn to_string ( & self ) -> String {
1773+ default fn to_string ( & self ) -> String {
17741774 use core:: fmt:: Write ;
17751775 let mut buf = String :: new ( ) ;
17761776 let _ = buf. write_fmt ( format_args ! ( "{}" , self ) ) ;
@@ -1779,6 +1779,14 @@ impl<T: fmt::Display + ?Sized> ToString for T {
17791779 }
17801780}
17811781
1782+ #[ stable( feature = "str_to_string_specialization" , since = "1.9.0" ) ]
1783+ impl ToString for str {
1784+ #[ inline]
1785+ fn to_string ( & self ) -> String {
1786+ String :: from ( self )
1787+ }
1788+ }
1789+
17821790#[ stable( feature = "rust1" , since = "1.0.0" ) ]
17831791impl AsRef < str > for String {
17841792 #[ inline]
You can’t perform that action at this time.
0 commit comments