about summary refs log tree commit diff
path: root/src/libsyntax/print
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2014-09-06 15:23:55 -0700
committerPatrick Walton <pcwalton@mimiga.net>2014-09-08 16:12:13 -0700
commiteb678ff87f0cdbf523b26fe9255cff684b4091e5 (patch)
tree9fb3745051a57fd5f73d6d50aabf07ce9d2f6ea4 /src/libsyntax/print
parent6f34760e4173dda94162502153fe4c5a2a96fc9d (diff)
downloadrust-eb678ff87f0cdbf523b26fe9255cff684b4091e5.tar.gz
rust-eb678ff87f0cdbf523b26fe9255cff684b4091e5.zip
librustc: Change the syntax of subslice matching to use postfix `..`
instead of prefix `..`.

This breaks code that looked like:

    match foo {
        [ first, ..middle, last ] => { ... }
    }

Change this code to:

    match foo {
        [ first, middle.., last ] => { ... }
    }

RFC #55.

Closes #16967.

[breaking-change]
Diffstat (limited to 'src/libsyntax/print')
-rw-r--r--src/libsyntax/print/pprust.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index d5bc1bfe956..eaeb6aaab8a 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -1912,13 +1912,13 @@ impl<'a> State<'a> {
                                    |s, p| s.print_pat(&**p)));
                 for p in slice.iter() {
                     if !before.is_empty() { try!(self.word_space(",")); }
+                    try!(self.print_pat(&**p));
                     match **p {
                         ast::Pat { node: ast::PatWild(ast::PatWildMulti), .. } => {
                             // this case is handled by print_pat
                         }
                         _ => try!(word(&mut self.s, "..")),
                     }
-                    try!(self.print_pat(&**p));
                     if !after.is_empty() { try!(self.word_space(",")); }
                 }
                 try!(self.commasep(Inconsistent,