summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorLeo Testard <leo.testard@gmail.com>2016-04-09 18:01:14 +0200
committerLeo Testard <leo.testard@gmail.com>2016-04-22 01:40:33 +0200
commitfa23d108638b7117e84c99a8d36a9dbab7b56812 (patch)
tree3171d992f6e061e33f0be4dc533485a4ab290aea /src/libsyntax
parent03ab057f97910769846f06ef904eb3eedc20134e (diff)
downloadrust-fa23d108638b7117e84c99a8d36a9dbab7b56812.tar.gz
rust-fa23d108638b7117e84c99a8d36a9dbab7b56812.zip
Remove some useless code.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ext/expand.rs10
-rw-r--r--src/libsyntax/feature_gate.rs42
2 files changed, 15 insertions, 37 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index 16b465ba36e..3424696fa7f 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -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);
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index 63fc33e4872..c6b398507d4 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -654,39 +654,6 @@ impl GatedCfg {
     }
 }
 
-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 const EXPLAIN_CUSTOM_DERIVE: &'static str =
 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>,
 }