about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBen Blum <bblum@andrew.cmu.edu>2013-06-19 22:27:06 -0400
committerBen Blum <bblum@andrew.cmu.edu>2013-06-23 17:54:25 -0400
commitba3f43e506de97109788e4a96df438b3c89f5e49 (patch)
tree2820c660052d6ee3e8defa37f362f8cf6450eab8
parent1d2b20ee2c4b6a0f71a4c2f85e4b10157d616c0f (diff)
downloadrust-ba3f43e506de97109788e4a96df438b3c89f5e49.tar.gz
rust-ba3f43e506de97109788e4a96df438b3c89f5e49.zip
Fix pretty-printing builtin bounds on closures and traits
-rw-r--r--src/librustc/util/ppaux.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs
index 2a0b97d4cb1..e25267f4441 100644
--- a/src/librustc/util/ppaux.rs
+++ b/src/librustc/util/ppaux.rs
@@ -365,6 +365,9 @@ pub fn ty_to_str(cx: ctxt, typ: t) -> ~str {
 
         s.push_str("fn");
 
+        if !cty.bounds.is_empty() {
+            s.push_str(":");
+        }
         s.push_str(cty.bounds.repr(cx));
 
         push_sig_to_str(cx, &mut s, &cty.sig);
@@ -457,9 +460,10 @@ pub fn ty_to_str(cx: ctxt, typ: t) -> ~str {
         let path = ty::item_path(cx, did);
         let base = ast_map::path_to_str(path, cx.sess.intr());
         let ty = parameterized(cx, base, substs.self_r, substs.tps);
+        let bound_sep = if bounds.is_empty() { "" } else { ":" };
         let bound_str = bounds.repr(cx);
-        fmt!("%s%s%s%s", trait_store_to_str(cx, s), mutability_to_str(mutbl), ty,
-                         bound_str)
+        fmt!("%s%s%s%s%s", trait_store_to_str(cx, s), mutability_to_str(mutbl), ty,
+                           bound_sep, bound_str)
       }
       ty_evec(ref mt, vs) => {
         vstore_ty_to_str(cx, mt, vs)