Skip to content

Commit ba3f43e

Browse files
committed
Fix pretty-printing builtin bounds on closures and traits
1 parent 1d2b20e commit ba3f43e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/librustc/util/ppaux.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,9 @@ pub fn ty_to_str(cx: ctxt, typ: t) -> ~str {
365365

366366
s.push_str("fn");
367367

368+
if !cty.bounds.is_empty() {
369+
s.push_str(":");
370+
}
368371
s.push_str(cty.bounds.repr(cx));
369372

370373
push_sig_to_str(cx, &mut s, &cty.sig);
@@ -457,9 +460,10 @@ pub fn ty_to_str(cx: ctxt, typ: t) -> ~str {
457460
let path = ty::item_path(cx, did);
458461
let base = ast_map::path_to_str(path, cx.sess.intr());
459462
let ty = parameterized(cx, base, substs.self_r, substs.tps);
463+
let bound_sep = if bounds.is_empty() { "" } else { ":" };
460464
let bound_str = bounds.repr(cx);
461-
fmt!("%s%s%s%s", trait_store_to_str(cx, s), mutability_to_str(mutbl), ty,
462-
bound_str)
465+
fmt!("%s%s%s%s%s", trait_store_to_str(cx, s), mutability_to_str(mutbl), ty,
466+
bound_sep, bound_str)
463467
}
464468
ty_evec(ref mt, vs) => {
465469
vstore_ty_to_str(cx, mt, vs)

0 commit comments

Comments
 (0)