We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents dd5c737 + db4720b commit eae3270Copy full SHA for eae3270
src/libstd/repr.rs
@@ -189,8 +189,7 @@ impl<'self> ReprVisitor<'self> {
189
} else if mtbl == 1 {
190
// skip, this is ast::m_imm
191
} else {
192
- assert_eq!(mtbl, 2);
193
- self.writer.write("const ".as_bytes());
+ fail!("invalid mutability value");
194
}
195
196
@@ -389,6 +388,7 @@ impl<'self> TyVisitor for ReprVisitor<'self> {
389
388
fn visit_evec_slice(&mut self, mtbl: uint, inner: *TyDesc) -> bool {
390
do self.get::<raw::Slice<()>> |this, s| {
391
this.writer.write(['&' as u8]);
+ this.write_mut_qualifier(mtbl);
392
this.write_vec_range(mtbl, s.data, s.len, inner);
393
394
@@ -696,6 +696,9 @@ fn test_repr() {
696
exact_test(&(10u64, ~"hello"),
697
"(10u64, ~\"hello\")");
698
699
+ exact_test(&(&[1, 2]), "&[1, 2]");
700
+ exact_test(&(&mut [1, 2]), "&mut [1, 2]");
701
+
702
exact_test(&'\'', "'\\''");
703
exact_test(&'"', "'\"'");
704
exact_test(&("'"), "\"'\"");
0 commit comments