diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2016-05-27 09:57:00 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2016-05-27 09:57:00 +0530 |
| commit | 35785712cd5e1acbfebd168c045b2e184ae979cc (patch) | |
| tree | 2a26d66185c4570f3ab6055860c7f8ce1efad57a /src/libsyntax/ast.rs | |
| parent | a70880fea967715e964f459746a77aa9e93dc35f (diff) | |
| parent | 0ca9bf394006fe635a4a76ca6fa78a70633666f0 (diff) | |
| download | rust-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.rs | 16 |
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)` |
