Skip to content

Commit ec7cd77

Browse files
committed
repr: write the mutability qualifier for slices
1 parent dd5c737 commit ec7cd77

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/libstd/repr.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ impl<'self> TyVisitor for ReprVisitor<'self> {
389389
fn visit_evec_slice(&mut self, mtbl: uint, inner: *TyDesc) -> bool {
390390
do self.get::<raw::Slice<()>> |this, s| {
391391
this.writer.write(['&' as u8]);
392+
this.write_mut_qualifier(mtbl);
392393
this.write_vec_range(mtbl, s.data, s.len, inner);
393394
}
394395
}
@@ -696,6 +697,9 @@ fn test_repr() {
696697
exact_test(&(10u64, ~"hello"),
697698
"(10u64, ~\"hello\")");
698699

700+
exact_test(&(&[1, 2]), "&[1, 2]");
701+
exact_test(&(&mut [1, 2]), "&mut [1, 2]");
702+
699703
exact_test(&'\'', "'\\''");
700704
exact_test(&'"', "'\"'");
701705
exact_test(&("'"), "\"'\"");

0 commit comments

Comments
 (0)