Skip to content

Commit d69aeaf

Browse files
committedMay 26, 2016
Implement .. in tuple (struct) patterns
1 parent d5759a3 commit d69aeaf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+736
-299
lines changed
 

‎src/doc/reference.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2433,6 +2433,8 @@ The currently implemented features of the reference compiler are:
24332433
* - `abi_vectorcall` - Allows the usage of the vectorcall calling convention
24342434
(e.g. `extern "vectorcall" func fn_();`)
24352435

2436+
* - `dotdot_in_tuple_patterns` - Allows `..` in tuple (struct) patterns.
2437+
24362438
If a feature is promoted to a language feature, then all existing programs will
24372439
start to receive compilation warnings about `#![feature]` directives which enabled
24382440
the new feature (because the directive is no longer necessary). However, if a

‎src/librustc/cfg/construct.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
100100
fn pat(&mut self, pat: &hir::Pat, pred: CFGIndex) -> CFGIndex {
101101
match pat.node {
102102
PatKind::Ident(_, _, None) |
103-
PatKind::TupleStruct(_, None) |
104103
PatKind::Path(..) |
105104
PatKind::QPath(..) |
106105
PatKind::Lit(..) |
@@ -116,8 +115,8 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
116115
self.add_ast_node(pat.id, &[subpat_exit])
117116
}
118117

119-
PatKind::TupleStruct(_, Some(ref subpats)) |
120-
PatKind::Tup(ref subpats) => {
118+
PatKind::TupleStruct(_, ref subpats, _) |
119+
PatKind::Tuple(ref subpats, _) => {
121120
let pats_exit = self.pats_all(subpats.iter(), pred);
122121
self.add_ast_node(pat.id, &[pats_exit])
123122
}

0 commit comments

Comments
 (0)