repr: write the mutability qualifier for slices

This commit is contained in:
Daniel Micay 2013-09-08 23:13:31 -04:00
parent dd5c7379e9
commit ec7cd77bd0

View File

@ -389,6 +389,7 @@ impl<'self> TyVisitor for ReprVisitor<'self> {
fn visit_evec_slice(&mut self, mtbl: uint, inner: *TyDesc) -> bool {
do self.get::<raw::Slice<()>> |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(&("'"), "\"'\"");