@@ -16,7 +16,7 @@ use any;
1616use cell:: { Cell , Ref , RefMut } ;
1717use collections:: Collection ;
1818use iter:: { Iterator , range} ;
19- use kinds:: Copy ;
19+ use kinds:: { Copy , Sized } ;
2020use mem;
2121use option:: { Option , Some , None } ;
2222use ops:: Deref ;
@@ -168,85 +168,85 @@ impl<'a> Show for Arguments<'a> {
168168/// When a format is not otherwise specified, types are formatted by ascribing
169169/// to this trait. There is not an explicit way of selecting this trait to be
170170/// used for formatting, it is only if no other format is specified.
171- pub trait Show {
171+ pub trait Show for Sized ? {
172172 /// Formats the value using the given formatter.
173173 fn fmt ( & self , & mut Formatter ) -> Result ;
174174}
175175
176176/// Format trait for the `b` character
177- pub trait Bool {
177+ pub trait Bool for Sized ? {
178178 /// Formats the value using the given formatter.
179179 fn fmt ( & self , & mut Formatter ) -> Result ;
180180}
181181
182182/// Format trait for the `c` character
183- pub trait Char {
183+ pub trait Char for Sized ? {
184184 /// Formats the value using the given formatter.
185185 fn fmt ( & self , & mut Formatter ) -> Result ;
186186}
187187
188188/// Format trait for the `i` and `d` characters
189- pub trait Signed {
189+ pub trait Signed for Sized ? {
190190 /// Formats the value using the given formatter.
191191 fn fmt ( & self , & mut Formatter ) -> Result ;
192192}
193193
194194/// Format trait for the `u` character
195- pub trait Unsigned {
195+ pub trait Unsigned for Sized ? {
196196 /// Formats the value using the given formatter.
197197 fn fmt ( & self , & mut Formatter ) -> Result ;
198198}
199199
200200/// Format trait for the `o` character
201- pub trait Octal {
201+ pub trait Octal for Sized ? {
202202 /// Formats the value using the given formatter.
203203 fn fmt ( & self , & mut Formatter ) -> Result ;
204204}
205205
206206/// Format trait for the `t` character
207- pub trait Binary {
207+ pub trait Binary for Sized ? {
208208 /// Formats the value using the given formatter.
209209 fn fmt ( & self , & mut Formatter ) -> Result ;
210210}
211211
212212/// Format trait for the `x` character
213- pub trait LowerHex {
213+ pub trait LowerHex for Sized ? {
214214 /// Formats the value using the given formatter.
215215 fn fmt ( & self , & mut Formatter ) -> Result ;
216216}
217217
218218/// Format trait for the `X` character
219- pub trait UpperHex {
219+ pub trait UpperHex for Sized ? {
220220 /// Formats the value using the given formatter.
221221 fn fmt ( & self , & mut Formatter ) -> Result ;
222222}
223223
224224/// Format trait for the `s` character
225- pub trait String {
225+ pub trait String for Sized ? {
226226 /// Formats the value using the given formatter.
227227 fn fmt ( & self , & mut Formatter ) -> Result ;
228228}
229229
230230/// Format trait for the `p` character
231- pub trait Pointer {
231+ pub trait Pointer for Sized ? {
232232 /// Formats the value using the given formatter.
233233 fn fmt ( & self , & mut Formatter ) -> Result ;
234234}
235235
236236/// Format trait for the `f` character
237- pub trait Float {
237+ pub trait Float for Sized ? {
238238 /// Formats the value using the given formatter.
239239 fn fmt ( & self , & mut Formatter ) -> Result ;
240240}
241241
242242/// Format trait for the `e` character
243- pub trait LowerExp {
243+ pub trait LowerExp for Sized ? {
244244 /// Formats the value using the given formatter.
245245 fn fmt ( & self , & mut Formatter ) -> Result ;
246246}
247247
248248/// Format trait for the `E` character
249- pub trait UpperExp {
249+ pub trait UpperExp for Sized ? {
250250 /// Formats the value using the given formatter.
251251 fn fmt ( & self , & mut Formatter ) -> Result ;
252252}
@@ -257,7 +257,7 @@ macro_rules! uniform_fn_call_workaround {
257257 ( $( $name: ident, $trait_: ident; ) * ) => {
258258 $(
259259 #[ doc( hidden) ]
260- pub fn $name<T : $trait_>( x: & T , fmt: & mut Formatter ) -> Result {
260+ pub fn $name<Sized ? T : $trait_>( x: & T , fmt: & mut Formatter ) -> Result {
261261 x. fmt( fmt)
262262 }
263263 ) *
@@ -583,10 +583,10 @@ pub fn argumentuint<'a>(s: &'a uint) -> Argument<'a> {
583583
584584// Implementations of the core formatting traits
585585
586- impl < ' a , T : Show > Show for & ' a T {
586+ impl < ' a , Sized ? T : Show > Show for & ' a T {
587587 fn fmt ( & self , f : & mut Formatter ) -> Result { secret_show ( * self , f) }
588588}
589- impl < ' a , T : Show > Show for & ' a mut T {
589+ impl < ' a , Sized ? T : Show > Show for & ' a mut T {
590590 fn fmt ( & self , f : & mut Formatter ) -> Result { secret_show ( & * * self , f) }
591591}
592592impl < ' a > Show for & ' a Show +' a {
@@ -599,12 +599,18 @@ impl Bool for bool {
599599 }
600600}
601601
602- impl < ' a , T : str:: Str > String for T {
602+ impl < T : str:: Str > String for T {
603603 fn fmt ( & self , f : & mut Formatter ) -> Result {
604604 f. pad ( self . as_slice ( ) )
605605 }
606606}
607607
608+ impl String for str {
609+ fn fmt ( & self , f : & mut Formatter ) -> Result {
610+ f. pad ( self )
611+ }
612+ }
613+
608614impl Char for char {
609615 fn fmt ( & self , f : & mut Formatter ) -> Result {
610616 use char:: Char ;
@@ -708,13 +714,13 @@ floating!(f64)
708714// Implementation of Show for various core types
709715
710716macro_rules! delegate( ( $ty: ty to $other: ident) => {
711- impl < ' a> Show for $ty {
717+ impl Show for $ty {
712718 fn fmt( & self , f: & mut Formatter ) -> Result {
713719 ( concat_idents!( secret_, $other) ( self , f) )
714720 }
715721 }
716722} )
717- delegate ! ( & ' a str to string)
723+ delegate ! ( str to string)
718724delegate ! ( bool to bool )
719725delegate ! ( char to char )
720726delegate ! ( f32 to float)
@@ -761,7 +767,7 @@ impl<'a> Show for &'a any::Any+'a {
761767 fn fmt ( & self , f : & mut Formatter ) -> Result { f. pad ( "&Any" ) }
762768}
763769
764- impl < ' a , T : Show > Show for & ' a [ T ] {
770+ impl < T : Show > Show for [ T ] {
765771 fn fmt ( & self , f : & mut Formatter ) -> Result {
766772 if f. flags & ( 1 << ( rt:: FlagAlternate as uint ) ) == 0 {
767773 try!( write ! ( f, "[" ) ) ;
@@ -782,12 +788,6 @@ impl<'a, T: Show> Show for &'a [T] {
782788 }
783789}
784790
785- impl < ' a , T : Show > Show for & ' a mut [ T ] {
786- fn fmt ( & self , f : & mut Formatter ) -> Result {
787- secret_show ( & self . as_slice ( ) , f)
788- }
789- }
790-
791791impl Show for ( ) {
792792 fn fmt ( & self , f : & mut Formatter ) -> Result {
793793 f. pad ( "()" )
0 commit comments