提交 ba8b9324 编写于 作者: J Jeffrey Seyfried

Move `placement_in_syntax` gated feature checking from expansion to the post-expansion visitor

上级 82b49cd2
......@@ -70,7 +70,6 @@ fn dummy($span: Span) -> Self { $dummy }
}
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);
......
......@@ -997,6 +997,9 @@ fn visit_expr(&mut self, e: &ast::Expr) {
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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册