Skip to content

Commit c2510fd

Browse files
committed
Fix pretty-printing builtin bounds on closures and traits
1 parent 20f10c3 commit c2510fd

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
@@ -362,6 +362,9 @@ pub fn ty_to_str(cx: ctxt, typ: t) -> ~str {
362362

363363
s.push_str("fn");
364364

365+
if !cty.bounds.is_empty() {
366+
s.push_str(":");
367+
}
365368
s.push_str(cty.bounds.repr(cx));
366369

367370
push_sig_to_str(cx, &mut s, &cty.sig);
@@ -452,9 +455,10 @@ pub fn ty_to_str(cx: ctxt, typ: t) -> ~str {
452455
let path = ty::item_path(cx, did);
453456
let base = ast_map::path_to_str(path, cx.sess.intr());
454457
let ty = parameterized(cx, base, substs.self_r, substs.tps);
458+
let bound_sep = if bounds.is_empty() { "" } else { ":" };
455459
let bound_str = bounds.repr(cx);
456-
fmt!("%s%s%s%s", trait_store_to_str(cx, s), mutability_to_str(mutbl), ty,
457-
bound_str)
460+
fmt!("%s%s%s%s%s", trait_store_to_str(cx, s), mutability_to_str(mutbl), ty,
461+
bound_sep, bound_str)
458462
}
459463
ty_evec(ref mt, vs) => {
460464
vstore_ty_to_str(cx, mt, vs)

0 commit comments

Comments
 (0)