File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -2867,6 +2867,19 @@ impl<'a> Parser<'a> {
28672867 // parse ref pat
28682868 let mutbl = self . parse_mutability ( ) ;
28692869 pat = self . parse_pat_ident ( BindByRef ( mutbl) ) ;
2870+ } else if self . eat_keyword ( keywords:: Box ) {
2871+ // `box PAT`
2872+ //
2873+ // FIXME(#13910): Rename to `PatBox` and extend to full DST
2874+ // support.
2875+ let sub = self . parse_pat ( ) ;
2876+ pat = PatUniq ( sub) ;
2877+ hi = self . last_span . hi ;
2878+ return @ast:: Pat {
2879+ id : ast:: DUMMY_NODE_ID ,
2880+ node : pat,
2881+ span : mk_sp ( lo, hi)
2882+ }
28702883 } else {
28712884 let can_be_enum_or_struct = self . look_ahead ( 1 , |t| {
28722885 match * t {
Original file line number Diff line number Diff line change 1+ // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2+ // file at the top-level directory of this distribution and at
3+ // http://rust-lang.org/COPYRIGHT.
4+ //
5+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+ // option. This file may not be copied, modified, or distributed
9+ // except according to those terms.
10+
11+ fn main ( ) {
12+ let box x = box 3 ;
13+ match box 3 {
14+ box y => {
15+ assert ! ( x == y) ;
16+ println ! ( "{} {}" , x, y) ;
17+ }
18+ }
19+ }
20+
You can’t perform that action at this time.
0 commit comments