@@ -2002,6 +2002,12 @@ impl<'a, T: fmt::Show> fmt::Show for &'a [T] {
20022002 }
20032003}
20042004
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+
20052011impl < T : fmt:: Show > fmt:: Show for ~[ T ] {
20062012 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
20072013 self . as_slice ( ) . fmt ( f)
@@ -3408,6 +3414,12 @@ mod tests {
34083414 test_show_vec ! ( ~[ 1 ] , "[1]" . to_owned( ) ) ;
34093415 test_show_vec ! ( ~[ 1 , 2 , 3 ] , "[1, 2, 3]" . to_owned( ) ) ;
34103416 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( ) ) ;
34113423 }
34123424
34133425 #[ test]
0 commit comments