Skip to content

Commit 20bfff6

Browse files
committed
Revert "pre-expansion gate box_syntax"
This reverts commit e4ed886.
1 parent 4c947a2 commit 20bfff6

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/libsyntax/feature_gate/check.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ fn leveled_feature_err<'a, S: Into<MultiSpan>>(
153153

154154
}
155155

156+
const EXPLAIN_BOX_SYNTAX: &str =
157+
"box expression syntax is experimental; you can call `Box::new` instead";
158+
156159
pub const EXPLAIN_STMT_ATTR_SYNTAX: &str =
157160
"attributes on expressions are experimental";
158161

@@ -504,6 +507,9 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
504507

505508
fn visit_expr(&mut self, e: &'a ast::Expr) {
506509
match e.kind {
510+
ast::ExprKind::Box(_) => {
511+
gate_feature_post!(&self, box_syntax, e.span, EXPLAIN_BOX_SYNTAX);
512+
}
507513
ast::ExprKind::Type(..) => {
508514
// To avoid noise about type ascription in common syntax errors, only emit if it
509515
// is the *only* error.
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
// Test that the use of the box syntax is gated by `box_syntax` feature gate.
22

3-
#[cfg(FALSE)]
4-
fn foo() {
3+
fn main() {
54
let x = box 3;
65
//~^ ERROR box expression syntax is experimental; you can call `Box::new` instead
76
}
8-
9-
fn main() {}

src/test/ui/feature-gates/feature-gate-box_syntax.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: box expression syntax is experimental; you can call `Box::new` instead
2-
--> $DIR/feature-gate-box_syntax.rs:5:13
2+
--> $DIR/feature-gate-box_syntax.rs:4:13
33
|
44
LL | let x = box 3;
55
| ^^^^^

0 commit comments

Comments
 (0)