summary refs log tree commit diff
path: root/src/libsyntax/ast.rs
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2016-05-27 09:57:00 +0530
committerManish Goregaokar <manishsmail@gmail.com>2016-05-27 09:57:00 +0530
commit35785712cd5e1acbfebd168c045b2e184ae979cc (patch)
tree2a26d66185c4570f3ab6055860c7f8ce1efad57a /src/libsyntax/ast.rs
parenta70880fea967715e964f459746a77aa9e93dc35f (diff)
parent0ca9bf394006fe635a4a76ca6fa78a70633666f0 (diff)
downloadrust-35785712cd5e1acbfebd168c045b2e184ae979cc.tar.gz
rust-35785712cd5e1acbfebd168c045b2e184ae979cc.zip
Rollup merge of #33639 - petrochenkov:dotdot, r=nmatsakis
 cc https://github.com/rust-lang/rust/issues/33627
r? @nikomatsakis

plugin-[breaking-change] cc https://github.com/rust-lang/rust/issues/31645 @Manishearth
Diffstat (limited to 'src/libsyntax/ast.rs')
-rw-r--r--src/libsyntax/ast.rs16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 4a94d8b01a3..757b92993cd 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -567,7 +567,7 @@ impl Pat {
             PatKind::Struct(_, ref fields, _) => {
                 fields.iter().all(|field| field.node.pat.walk(it))
             }
-            PatKind::TupleStruct(_, Some(ref s)) | PatKind::Tup(ref s) => {
+            PatKind::TupleStruct(_, ref s, _) | PatKind::Tuple(ref s, _) => {
                 s.iter().all(|p| p.walk(it))
             }
             PatKind::Box(ref s) | PatKind::Ref(ref s, _) => {
@@ -582,7 +582,6 @@ impl Pat {
             PatKind::Lit(_) |
             PatKind::Range(_, _) |
             PatKind::Ident(_, _, _) |
-            PatKind::TupleStruct(..) |
             PatKind::Path(..) |
             PatKind::QPath(_, _) |
             PatKind::Mac(_) => {
@@ -631,9 +630,10 @@ pub enum PatKind {
     /// The `bool` is `true` in the presence of a `..`.
     Struct(Path, Vec<Spanned<FieldPat>>, bool),
 
-    /// A tuple struct/variant pattern `Variant(x, y, z)`.
-    /// "None" means a `Variant(..)` pattern where we don't bind the fields to names.
-    TupleStruct(Path, Option<Vec<P<Pat>>>),
+    /// A tuple struct/variant pattern `Variant(x, y, .., z)`.
+    /// If the `..` pattern fragment is present, then `Option<usize>` denotes its position.
+    /// 0 <= position <= subpats.len()
+    TupleStruct(Path, Vec<P<Pat>>, Option<usize>),
 
     /// A path pattern.
     /// Such pattern can be resolved to a unit struct/variant or a constant.
@@ -645,8 +645,10 @@ pub enum PatKind {
     /// PatKind::Path, and the resolver will have to sort that out.
     QPath(QSelf, Path),
 
-    /// A tuple pattern `(a, b)`
-    Tup(Vec<P<Pat>>),
+    /// A tuple pattern `(a, b)`.
+    /// If the `..` pattern fragment is present, then `Option<usize>` denotes its position.
+    /// 0 <= position <= subpats.len()
+    Tuple(Vec<P<Pat>>, Option<usize>),
     /// A `box` pattern
     Box(P<Pat>),
     /// A reference pattern, e.g. `&mut (a, b)`