mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-08 22:06:22 +00:00
repr: write the mutability qualifier for slices
This commit is contained in:
parent
dd5c7379e9
commit
ec7cd77bd0
@ -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(&("'"), "\"'\"");
|
||||
|
Loading…
Reference in New Issue
Block a user