rollup merge of #20723: pnkfelix/feature-gate-box-syntax

Conflicts:
	src/compiletest/compiletest.rs
	src/libcollections/lib.rs
	src/libserialize/lib.rs
	src/libsyntax/feature_gate.rs
This commit is contained in:
Alex Crichton 2015-01-07 17:42:47 -08:00
commit 373cbab5b0
287 changed files with 784 additions and 15 deletions

View file

@ -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)

View file

@ -25,6 +25,7 @@
#![allow(unknown_features)]
#![feature(slicing_syntax)]
#![feature(box_syntax)]
#![feature(quote, unsafe_destructor)]
extern crate arena;