diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index c802e40dd05..c0cbf78c5cf 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -379,19 +379,16 @@ fn print_field(s: ps, f: ast::ty_field) { word(s.s, constrs_str(cs, ty_constr_to_str)); } ast::ty_vstore(t, v) { - // If it is a vector, print it in prefix notation. - // Someday it will all be like this. - let is_fixed = alt v { ast::vstore_fixed(_) { true } _ { false } }; - alt t.node { - ast::ty_vec(*) if !is_fixed { - print_vstore(s, v); - print_type(s, t); - } - _ { + alt v { + ast::vstore_fixed(_) { print_type(s, t); word(s.s, "/"); print_vstore(s, v); } + _ { + print_vstore(s, v); + print_type(s, t); + } } } ast::ty_mac(_) { @@ -888,19 +885,16 @@ fn print_expr(s: ps, &&expr: @ast::expr) { s.ann.pre(ann_node); alt expr.node { ast::expr_vstore(e, v) { - // If it is a vector, print it in prefix notation. - // Someday it will all be like this. - let is_fixed = alt v { ast::vstore_fixed(_) { true } _ { false } }; - alt e.node { - ast::expr_vec(*) if !is_fixed { - print_vstore(s, v); - print_expr(s, e); - } - _ { + alt v { + ast::vstore_fixed(_) { print_expr(s, e); word(s.s, "/"); print_vstore(s, v); } + _ { + print_vstore(s, v); + print_expr(s, e); + } } } ast::expr_vec(exprs, mutbl) { diff --git a/src/rustc/util/ppaux.rs b/src/rustc/util/ppaux.rs index 91edf4bb0d7..01593ecea2c 100644 --- a/src/rustc/util/ppaux.rs +++ b/src/rustc/util/ppaux.rs @@ -100,6 +100,15 @@ fn vstore_to_str(cx: ctxt, vs: ty::vstore) -> str { } } +fn vstore_ty_to_str(cx: ctxt, ty: str, vs: ty::vstore) -> str { + alt vs { + ty::vstore_fixed(_) { + #fmt["%s/%s", ty, vstore_to_str(cx, vs)] + } + _ { #fmt["%s%s", vstore_to_str(cx, vs), ty] } + } +} + fn tys_to_str(cx: ctxt, ts: ~[t]) -> str { let mut rs = ""; for ts.each |t| { rs += ty_to_str(cx, t); } @@ -223,14 +232,9 @@ fn field_to_str(cx: ctxt, f: field) -> str { parameterized(cx, base, substs.self_r, substs.tps) } ty_evec(mt, vs) { - alt vs { - ty::vstore_fixed(_) { - #fmt["[%s]/%s", mt_to_str(cx, mt), vstore_to_str(cx, vs)] - } - _ { #fmt["%s[%s]", vstore_to_str(cx, vs), mt_to_str(cx, mt)] } - } + vstore_ty_to_str(cx, #fmt["[%s]", mt_to_str(cx, mt)], vs) } - ty_estr(vs) { #fmt["str/%s", vstore_to_str(cx, vs)] } + ty_estr(vs) { vstore_ty_to_str(cx, "str", vs) } ty_opaque_box { "@?" } ty_constr(t, _) { "@?" } ty_opaque_closure_ptr(ck_block) { "closure&" } diff --git a/src/test/compile-fail/bad-const-type.rs b/src/test/compile-fail/bad-const-type.rs index 8b86db098e5..7c0601e7aa6 100644 --- a/src/test/compile-fail/bad-const-type.rs +++ b/src/test/compile-fail/bad-const-type.rs @@ -1,4 +1,4 @@ -// error-pattern:expected `str/~` but found `int` +// error-pattern:expected `~str` but found `int` const i: str = 10i; fn main() { log(debug, i); } diff --git a/src/test/compile-fail/binop-bitxor-str.rs b/src/test/compile-fail/binop-bitxor-str.rs index 53bb7d8f53d..b698eb7c426 100644 --- a/src/test/compile-fail/binop-bitxor-str.rs +++ b/src/test/compile-fail/binop-bitxor-str.rs @@ -1,3 +1,3 @@ -// error-pattern:^ cannot be applied to type `str/~` +// error-pattern:^ cannot be applied to type `~str` fn main() { let x = "a" ^ "b"; } diff --git a/src/test/compile-fail/fail-type-err.rs b/src/test/compile-fail/fail-type-err.rs index 3f9bda61c80..e3324cb59b4 100644 --- a/src/test/compile-fail/fail-type-err.rs +++ b/src/test/compile-fail/fail-type-err.rs @@ -1,2 +1,2 @@ -// error-pattern:expected `str/~` but found `~[int]` +// error-pattern:expected `~str` but found `~[int]` fn main() { fail ~[0i]; } diff --git a/src/test/compile-fail/map-types.rs b/src/test/compile-fail/map-types.rs index 9386c152648..b929ab0a1ce 100644 --- a/src/test/compile-fail/map-types.rs +++ b/src/test/compile-fail/map-types.rs @@ -8,5 +8,5 @@ fn main() { let x: map = map::str_hash::() as map::; let y: map = x; - //~^ ERROR mismatched types: expected `std::map::map` + //~^ ERROR mismatched types: expected `std::map::map` } diff --git a/src/test/compile-fail/minus-string.rs b/src/test/compile-fail/minus-string.rs index 043d46f121b..00037ce0fda 100644 --- a/src/test/compile-fail/minus-string.rs +++ b/src/test/compile-fail/minus-string.rs @@ -1,3 +1,3 @@ -// error-pattern:cannot apply unary operator `-` to type `str/~` +// error-pattern:cannot apply unary operator `-` to type `~str` fn main() { -"foo"; } diff --git a/src/test/compile-fail/missing-do.rs b/src/test/compile-fail/missing-do.rs index 31595875058..a54c5961d55 100644 --- a/src/test/compile-fail/missing-do.rs +++ b/src/test/compile-fail/missing-do.rs @@ -3,7 +3,7 @@ fn foo(f: fn()) { f() } fn main() { - "" || 42; //~ ERROR binary operation || cannot be applied to type `str/~` + "" || 42; //~ ERROR binary operation || cannot be applied to type `~str` foo || {}; //~ ERROR binary operation || cannot be applied to type `extern fn(fn())` //~^ NOTE did you forget the 'do' keyword for the call? }