Skip to content

Commit 4174688

Browse files
Bleibrson
authored andcommitted
libsyntax: adapt the pretty printer for the new fixed size array syntax
`[int]/5` -> `[int * 5]`
1 parent 55e40a1 commit 4174688

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/libsyntax/print/pprust.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,9 +399,21 @@ fn print_type_ex(s: ps, &&ty: @ast::Ty, print_colons: bool) {
399399
}
400400
ast::ty_path(path, _) => print_path(s, path, print_colons),
401401
ast::ty_fixed_length(t, v) => {
402-
print_type(s, t);
403-
word(s.s, ~"/");
402+
word(s.s, ~"[");
403+
match t.node {
404+
ast::ty_vec(mt) => {
405+
match mt.mutbl {
406+
ast::m_mutbl => word_space(s, ~"mut"),
407+
ast::m_const => word_space(s, ~"const"),
408+
ast::m_imm => ()
409+
}
410+
print_type(s, mt.ty);
411+
}
412+
_ => fail ~"ty_fixed_length can only contain ty_vec as type"
413+
}
414+
word(s.s, ~" * ");
404415
print_vstore(s, ast::vstore_fixed(v));
416+
word(s.s, ~"]");
405417
}
406418
ast::ty_mac(_) => {
407419
fail ~"print_type doesn't know how to print a ty_mac";

0 commit comments

Comments
 (0)