about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorJeffrey Seyfried <jeffrey.seyfried@gmail.com>2016-05-21 08:39:33 +0000
committerJeffrey Seyfried <jeffrey.seyfried@gmail.com>2016-05-21 23:02:34 +0000
commitba8b9324d6c10ce151de50057472f5c258476655 (patch)
treee3cbb0eb373a2f70240d3f447e343ee8f59d9064 /src/libsyntax
parent82b49cd2000859c8208cf15a78441a72a3edc499 (diff)
downloadrust-ba8b9324d6c10ce151de50057472f5c258476655.tar.gz
rust-ba8b9324d6c10ce151de50057472f5c258476655.zip
Move `placement_in_syntax` gated feature checking from expansion to the post-expansion visitor
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ext/expand.rs16
-rw-r--r--src/libsyntax/feature_gate.rs3
2 files changed, 3 insertions, 16 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index 9bfeb81b74a..df1bbf5f26e 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -70,7 +70,6 @@ impl_macro_generable! {
 }
 
 pub fn expand_expr(e: P<ast::Expr>, fld: &mut MacroExpander) -> P<ast::Expr> {
-    let expr_span = e.span;
     return e.and_then(|ast::Expr {id, node, span, attrs}| match node {
 
         // expr_mac should really be expr_ext or something; it's the
@@ -79,21 +78,6 @@ pub fn expand_expr(e: P<ast::Expr>, fld: &mut MacroExpander) -> P<ast::Expr> {
             expand_mac_invoc(mac, None, attrs.into_attr_vec(), span, fld)
         }
 
-        ast::ExprKind::InPlace(placer, value_expr) => {
-            // Ensure feature-gate is enabled
-            if !fld.cx.ecfg.features.unwrap().placement_in_syntax {
-                feature_gate::emit_feature_err(
-                    &fld.cx.parse_sess.span_diagnostic, "placement_in_syntax", expr_span,
-                    feature_gate::GateIssue::Language, feature_gate::EXPLAIN_PLACEMENT_IN
-                );
-            }
-
-            let placer = fld.fold_expr(placer);
-            let value_expr = fld.fold_expr(value_expr);
-            fld.cx.expr(span, ast::ExprKind::InPlace(placer, value_expr))
-                .with_attrs(fold_thin_attrs(attrs, fld))
-        }
-
         ast::ExprKind::While(cond, body, opt_ident) => {
             let cond = fld.fold_expr(cond);
             let (body, opt_ident) = expand_loop_block(body, opt_ident, fld);
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index acef98f2afc..dbef06f7aa4 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -997,6 +997,9 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
             ast::ExprKind::Try(..) => {
                 gate_feature_post!(&self, question_mark, e.span, "the `?` operator is not stable");
             }
+            ast::ExprKind::InPlace(..) => {
+                gate_feature_post!(&self, placement_in_syntax, e.span, EXPLAIN_PLACEMENT_IN);
+            }
             _ => {}
         }
         visit::walk_expr(self, e);