File tree Expand file tree Collapse file tree 3 files changed +33
-7
lines changed Expand file tree Collapse file tree 3 files changed +33
-7
lines changed Original file line number Diff line number Diff line change @@ -2326,6 +2326,22 @@ impl Parser {
23262326 _ => self . mk_unary ( UnUniq , e)
23272327 } ;
23282328 }
2329+ token:: IDENT ( _, _) if self . is_keyword ( keywords:: Box ) => {
2330+ self . bump ( ) ;
2331+
2332+ let subexpression = self . parse_prefix_expr ( ) ;
2333+ hi = subexpression. span . hi ;
2334+ // HACK: turn `box [...]` into a boxed-evec
2335+ ex = match subexpression. node {
2336+ ExprVec ( ..) |
2337+ ExprLit ( @codemap:: Spanned {
2338+ node : lit_str( ..) ,
2339+ span : _
2340+ } ) |
2341+ ExprRepeat ( ..) => ExprVstore ( subexpression, ExprVstoreUniq ) ,
2342+ _ => self . mk_unary ( UnUniq , subexpression)
2343+ } ;
2344+ }
23292345 _ => return self . parse_dot_or_call_expr ( )
23302346 }
23312347 return self . mk_expr ( lo, hi, ex) ;
Original file line number Diff line number Diff line change @@ -465,15 +465,17 @@ declare_special_idents_and_keywords! {
465465 ( 45 , While , "while" ) ;
466466 ( 46 , Continue , "continue" ) ;
467467 ( 47 , Proc , "proc" ) ;
468+ ( 48 , Box , "box" ) ;
468469
469470 ' reserved:
470- ( 48 , Alignof , "alignof" ) ;
471- ( 49 , Be , "be" ) ;
472- ( 50 , Offsetof , "offsetof" ) ;
473- ( 51 , Pure , "pure" ) ;
474- ( 52 , Sizeof , "sizeof" ) ;
475- ( 53 , Typeof , "typeof" ) ;
476- ( 54 , Yield , "yield" ) ;
471+ ( 49 , Alignof , "alignof" ) ;
472+ ( 50 , Be , "be" ) ;
473+ ( 51 , Offsetof , "offsetof" ) ;
474+ ( 52 , Pure , "pure" ) ;
475+ ( 53 , Sizeof , "sizeof" ) ;
476+ ( 54 , Typeof , "typeof" ) ;
477+ ( 55 , Unsized , "unsized" ) ;
478+ ( 56 , Yield , "yield" ) ;
477479 }
478480}
479481
Original file line number Diff line number Diff line change 1+ /* Any copyright is dedicated to the Public Domain.
2+ * http://creativecommons.org/publicdomain/zero/1.0/ */
3+
4+ fn main ( ) {
5+ let x: ~int = box 3 ;
6+ println ! ( "{}" , * x) ;
7+ }
8+
You can’t perform that action at this time.
0 commit comments