]> git.lizzy.rs Git - rust.git/commitdiff
Fix pretty-printing builtin bounds on closures and traits
authorBen Blum <bblum@andrew.cmu.edu>
Thu, 20 Jun 2013 02:27:06 +0000 (22:27 -0400)
committerBen Blum <bblum@andrew.cmu.edu>
Sun, 23 Jun 2013 21:54:25 +0000 (17:54 -0400)
src/librustc/util/ppaux.rs

index 2a0b97d4cb1b34c479e238cb6327301aeb074f15..e25267f4441236f4aeea9775125fb829b904fb4d 100644 (file)
@@ -365,6 +365,9 @@ fn closure_to_str(cx: ctxt, cty: &ty::ClosureTy) -> ~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 @@ fn field_to_str(cx: ctxt, f: field) -> ~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)