From ec7cd77bd0d48967351d5097d94afd18eddae0f3 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Sun, 8 Sep 2013 23:13:31 -0400 Subject: [PATCH] repr: write the mutability qualifier for slices --- src/libstd/repr.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libstd/repr.rs b/src/libstd/repr.rs index 9873317738d..e211d5b6064 100644 --- a/src/libstd/repr.rs +++ b/src/libstd/repr.rs @@ -389,6 +389,7 @@ impl<'self> TyVisitor for ReprVisitor<'self> { fn visit_evec_slice(&mut self, mtbl: uint, inner: *TyDesc) -> bool { do self.get::> |this, s| { this.writer.write(['&' as u8]); + this.write_mut_qualifier(mtbl); this.write_vec_range(mtbl, s.data, s.len, inner); } } @@ -696,6 +697,9 @@ fn test_repr() { exact_test(&(10u64, ~"hello"), "(10u64, ~\"hello\")"); + exact_test(&(&[1, 2]), "&[1, 2]"); + exact_test(&(&mut [1, 2]), "&mut [1, 2]"); + exact_test(&'\'', "'\\''"); exact_test(&'"', "'\"'"); exact_test(&("'"), "\"'\"");