提交 fa23d108 编写于 作者: L Leo Testard

Remove some useless code.

上级 03ab057f
......@@ -83,10 +83,12 @@ pub fn expand_expr(e: P<ast::Expr>, fld: &mut MacroExpander) -> P<ast::Expr> {
ast::ExprKind::InPlace(placer, value_expr) => {
// Ensure feature-gate is enabled
feature_gate::check_for_placement_in(
fld.cx.ecfg.features,
&fld.cx.parse_sess.span_diagnostic,
expr_span);
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);
......
......@@ -654,39 +654,6 @@ fn check_and_emit(&self,
}
}
const EXPLAIN_BOX_SYNTAX: &'static str =
"box expression syntax is experimental; you can call `Box::new` instead.";
const EXPLAIN_PLACEMENT_IN: &'static str =
"placement-in expression syntax is experimental and subject to change.";
const EXPLAIN_PUSHPOP_UNSAFE: &'static str =
"push/pop_unsafe macros are experimental and subject to change.";
const EXPLAIN_STMT_ATTR_SYNTAX: &'static str =
"attributes on non-item statements and expressions are experimental.";
pub fn check_for_box_syntax(f: Option<&Features>, diag: &Handler, span: Span) {
if let Some(&Features { box_syntax: true, .. }) = f {
return;
}
emit_feature_err(diag, "box_syntax", span, GateIssue::Language, EXPLAIN_BOX_SYNTAX);
}
pub fn check_for_placement_in(f: Option<&Features>, diag: &Handler, span: Span) {
if let Some(&Features { placement_in_syntax: true, .. }) = f {
return;
}
emit_feature_err(diag, "placement_in_syntax", span, GateIssue::Language, EXPLAIN_PLACEMENT_IN);
}
pub fn check_for_pushpop_syntax(f: Option<&Features>, diag: &Handler, span: Span) {
if let Some(&Features { pushpop_unsafe: true, .. }) = f {
return;
}
emit_feature_err(diag, "pushpop_unsafe", span, GateIssue::Language, EXPLAIN_PUSHPOP_UNSAFE);
}
struct Context<'a> {
features: &'a Features,
span_handler: &'a Handler,
......@@ -809,6 +776,12 @@ pub fn emit_feature_err(diag: &Handler, feature: &str, span: Span, issue: GateIs
err.emit();
}
const EXPLAIN_BOX_SYNTAX: &'static str =
"box expression syntax is experimental; you can call `Box::new` instead.";
const EXPLAIN_STMT_ATTR_SYNTAX: &'static str =
"attributes on non-item statements and expressions are experimental.";
pub const EXPLAIN_ASM: &'static str =
"inline assembly is not stable enough for use and is subject to change";
......@@ -829,6 +802,9 @@ pub fn emit_feature_err(diag: &Handler, feature: &str, span: Span, issue: GateIs
pub const EXPLAIN_DERIVE_UNDERSCORE: &'static str =
"attributes of the form `#[derive_*]` are reserved for the compiler";
pub const EXPLAIN_PLACEMENT_IN: &'static str =
"placement-in expression syntax is experimental and subject to change.";
struct PostExpansionVisitor<'a> {
context: &'a Context<'a>,
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册