about summary refs log tree commit diff
path: root/src/libsyntax/print
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2012-11-06 18:41:06 -0800
committerPatrick Walton <pcwalton@mimiga.net>2012-11-07 19:29:30 -0800
commit0fc952372a1010bc567b1c183105e4fd3f395af0 (patch)
tree4cf44e50cf87c1a151dfc17a543710e7df5218fc /src/libsyntax/print
parentb223c9c4651ee2f4b8fe2af0136e657a0893caa4 (diff)
downloadrust-0fc952372a1010bc567b1c183105e4fd3f395af0.tar.gz
rust-0fc952372a1010bc567b1c183105e4fd3f395af0.zip
rustc: Support irrefutable patterns in function arguments. r=nmatsakis
Diffstat (limited to 'src/libsyntax/print')
-rw-r--r--src/libsyntax/print/pprust.rs19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index ed64d02cea3..0418f6776de 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -1386,7 +1386,7 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
         match lvl {
           ast::debug => { word_nbsp(s, ~"log"); print_expr(s, expr); }
           ast::error => { word_nbsp(s, ~"log_err"); print_expr(s, expr); }
-          ast::other => {
+          ast::log_other => {
             word_nbsp(s, ~"log");
             popen(s);
             print_expr(s, lexp);
@@ -1820,12 +1820,19 @@ fn print_arg(s: ps, input: ast::arg) {
     ibox(s, indent_unit);
     print_arg_mode(s, input.mode);
     match input.ty.node {
-      ast::ty_infer => print_ident(s, input.ident),
+      ast::ty_infer => print_pat(s, input.pat),
       _ => {
-        if input.ident != parse::token::special_idents::invalid {
-            print_ident(s, input.ident);
-            word(s.s, ~":");
-            space(s.s);
+        match input.pat.node {
+            ast::pat_ident(_, path, _) if
+                path.idents.len() == 1 &&
+                path.idents[0] == parse::token::special_idents::invalid => {
+                // Do nothing.
+            }
+            _ => {
+                print_pat(s, input.pat);
+                word(s.s, ~":");
+                space(s.s);
+            }
         }
         print_type(s, input.ty);
       }