about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-05-04 05:36:49 -0700
committerbors <bors@rust-lang.org>2014-05-04 05:36:49 -0700
commit9c1761d0ab04681ef65c6e589c7c663d917b5eb7 (patch)
tree1583f6d5dd9bb731801384e2ed85aec89c2b847f /src/libsyntax/parse/parser.rs
parentde99da3fa5d234e5938b4d87dd264b01eb6e86ac (diff)
parent80b43de5ab1bb063a1d1eaab64dd0389c4443541 (diff)
downloadrust-9c1761d0ab04681ef65c6e589c7c663d917b5eb7.tar.gz
rust-9c1761d0ab04681ef65c6e589c7c663d917b5eb7.zip
auto merge of #13908 : pcwalton/rust/box-pattern, r=alexcrichton
r? @alexcrichton
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
-rw-r--r--src/libsyntax/parse/parser.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index bb21bb0b898..11a773a7f09 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -2867,6 +2867,19 @@ impl<'a> Parser<'a> {
             // parse ref pat
             let mutbl = self.parse_mutability();
             pat = self.parse_pat_ident(BindByRef(mutbl));
+        } else if self.eat_keyword(keywords::Box) {
+            // `box PAT`
+            //
+            // FIXME(#13910): Rename to `PatBox` and extend to full DST
+            // support.
+            let sub = self.parse_pat();
+            pat = PatUniq(sub);
+            hi = self.last_span.hi;
+            return @ast::Pat {
+                id: ast::DUMMY_NODE_ID,
+                node: pat,
+                span: mk_sp(lo, hi)
+            }
         } else {
             let can_be_enum_or_struct = self.look_ahead(1, |t| {
                 match *t {