about summary refs log tree commit diff
path: root/src/libsyntax/feature_gate.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsyntax/feature_gate.rs')
-rw-r--r--src/libsyntax/feature_gate.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index 21d3e4fef7f..2cfcd38d48f 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -69,7 +69,8 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
     ("tuple_indexing", Accepted),
     ("associated_types", Accepted),
     ("visible_private_types", Active),
-    ("slicing_syntax", Accepted),
+    ("slicing_syntax", Active),
+    ("box_syntax", Active),
 
     ("if_let", Accepted),
     ("while_let", Accepted),
@@ -337,6 +338,15 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
     }
 
     fn visit_expr(&mut self, e: &ast::Expr) {
+        match e.node {
+            ast::ExprBox(..) | ast::ExprUnary(ast::UnOp::UnUniq, _) => {
+                self.gate_feature("box_syntax",
+                                  e.span,
+                                  "box expression syntax is experimental in alpha release; \
+                                   you can call `Box::new` instead.");
+            }
+            _ => {}
+        }
         visit::walk_expr(self, e);
     }
 
@@ -357,6 +367,11 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
                                    but at the end of a slice (e.g. \
                                    `[0, ..xs, 0]` are experimental")
             }
+            ast::PatBox(..) => {
+                self.gate_feature("box_syntax",
+                                  pattern.span,
+                                  "box pattern syntax is experimental in alpha release");
+            }
             _ => {}
         }
         visit::walk_pat(self, pattern)