Revert "pre-expansion gate box_syntax"

This reverts commit e4ed8865786a787a7b0c045f7674569b6be0e9bc.
This commit is contained in:
Eduard-Mihai Burtescu 2019-10-31 18:20:02 +02:00
parent 4c947a26f2
commit 20bfff66a9
3 changed files with 8 additions and 5 deletions

View File

@ -153,6 +153,9 @@ fn leveled_feature_err<'a, S: Into<MultiSpan>>(
}
const EXPLAIN_BOX_SYNTAX: &str =
"box expression syntax is experimental; you can call `Box::new` instead";
pub const EXPLAIN_STMT_ATTR_SYNTAX: &str =
"attributes on expressions are experimental";
@ -504,6 +507,9 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
fn visit_expr(&mut self, e: &'a ast::Expr) {
match e.kind {
ast::ExprKind::Box(_) => {
gate_feature_post!(&self, box_syntax, e.span, EXPLAIN_BOX_SYNTAX);
}
ast::ExprKind::Type(..) => {
// To avoid noise about type ascription in common syntax errors, only emit if it
// is the *only* error.

View File

@ -1,9 +1,6 @@
// Test that the use of the box syntax is gated by `box_syntax` feature gate.
#[cfg(FALSE)]
fn foo() {
fn main() {
let x = box 3;
//~^ ERROR box expression syntax is experimental; you can call `Box::new` instead
}
fn main() {}

View File

@ -1,5 +1,5 @@
error[E0658]: box expression syntax is experimental; you can call `Box::new` instead
--> $DIR/feature-gate-box_syntax.rs:5:13
--> $DIR/feature-gate-box_syntax.rs:4:13
|
LL | let x = box 3;
| ^^^^^