@@ -2002,6 +2002,12 @@ impl<'a, T: fmt::Show> fmt::Show for &'a [T] {
2002
2002
}
2003
2003
}
2004
2004
2005
+ impl < ' a , T : fmt:: Show > fmt:: Show for & ' a mut [ T ] {
2006
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
2007
+ self . as_slice ( ) . fmt ( f)
2008
+ }
2009
+ }
2010
+
2005
2011
impl < T : fmt:: Show > fmt:: Show for ~[ T ] {
2006
2012
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
2007
2013
self . as_slice ( ) . fmt ( f)
@@ -3408,6 +3414,12 @@ mod tests {
3408
3414
test_show_vec ! ( ~[ 1 ] , "[1]" . to_owned( ) ) ;
3409
3415
test_show_vec ! ( ~[ 1 , 2 , 3 ] , "[1, 2, 3]" . to_owned( ) ) ;
3410
3416
test_show_vec ! ( ~[ ~[ ] , ~[ 1 u] , ~[ 1 u, 1 u] ] , "[[], [1], [1, 1]]" . to_owned( ) ) ;
3417
+
3418
+ let empty_mut: & mut [ int ] = & mut [ ] ;
3419
+ test_show_vec ! ( empty_mut, "[]" . to_owned( ) ) ;
3420
+ test_show_vec ! ( & mut [ 1 ] , "[1]" . to_owned( ) ) ;
3421
+ test_show_vec ! ( & mut [ 1 , 2 , 3 ] , "[1, 2, 3]" . to_owned( ) ) ;
3422
+ test_show_vec ! ( & mut [ & mut [ ] , & mut [ 1 u] , & mut [ 1 u, 1 u] ] , "[[], [1], [1, 1]]" . to_owned( ) ) ;
3411
3423
}
3412
3424
3413
3425
#[ test]
0 commit comments