Skip to content

Commit fa23d10

Browse files
committed
Remove some useless code.
1 parent 03ab057 commit fa23d10

File tree

2 files changed

+15
-37
lines changed

2 files changed

+15
-37
lines changed

src/libsyntax/ext/expand.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,12 @@ pub fn expand_expr(e: P<ast::Expr>, fld: &mut MacroExpander) -> P<ast::Expr> {
8383

8484
ast::ExprKind::InPlace(placer, value_expr) => {
8585
// Ensure feature-gate is enabled
86-
feature_gate::check_for_placement_in(
87-
fld.cx.ecfg.features,
88-
&fld.cx.parse_sess.span_diagnostic,
89-
expr_span);
86+
if !fld.cx.ecfg.features.unwrap().placement_in_syntax {
87+
feature_gate::emit_feature_err(
88+
&fld.cx.parse_sess.span_diagnostic, "placement_in_syntax", expr_span,
89+
feature_gate::GateIssue::Language, feature_gate::EXPLAIN_PLACEMENT_IN
90+
);
91+
}
9092

9193
let placer = fld.fold_expr(placer);
9294
let value_expr = fld.fold_expr(value_expr);

src/libsyntax/feature_gate.rs

+9-33
Original file line numberDiff line numberDiff line change
@@ -654,39 +654,6 @@ impl GatedCfg {
654654
}
655655
}
656656

657-
const EXPLAIN_BOX_SYNTAX: &'static str =
658-
"box expression syntax is experimental; you can call `Box::new` instead.";
659-
660-
const EXPLAIN_PLACEMENT_IN: &'static str =
661-
"placement-in expression syntax is experimental and subject to change.";
662-
663-
const EXPLAIN_PUSHPOP_UNSAFE: &'static str =
664-
"push/pop_unsafe macros are experimental and subject to change.";
665-
666-
const EXPLAIN_STMT_ATTR_SYNTAX: &'static str =
667-
"attributes on non-item statements and expressions are experimental.";
668-
669-
pub fn check_for_box_syntax(f: Option<&Features>, diag: &Handler, span: Span) {
670-
if let Some(&Features { box_syntax: true, .. }) = f {
671-
return;
672-
}
673-
emit_feature_err(diag, "box_syntax", span, GateIssue::Language, EXPLAIN_BOX_SYNTAX);
674-
}
675-
676-
pub fn check_for_placement_in(f: Option<&Features>, diag: &Handler, span: Span) {
677-
if let Some(&Features { placement_in_syntax: true, .. }) = f {
678-
return;
679-
}
680-
emit_feature_err(diag, "placement_in_syntax", span, GateIssue::Language, EXPLAIN_PLACEMENT_IN);
681-
}
682-
683-
pub fn check_for_pushpop_syntax(f: Option<&Features>, diag: &Handler, span: Span) {
684-
if let Some(&Features { pushpop_unsafe: true, .. }) = f {
685-
return;
686-
}
687-
emit_feature_err(diag, "pushpop_unsafe", span, GateIssue::Language, EXPLAIN_PUSHPOP_UNSAFE);
688-
}
689-
690657
struct Context<'a> {
691658
features: &'a Features,
692659
span_handler: &'a Handler,
@@ -809,6 +776,12 @@ pub fn emit_feature_err(diag: &Handler, feature: &str, span: Span, issue: GateIs
809776
err.emit();
810777
}
811778

779+
const EXPLAIN_BOX_SYNTAX: &'static str =
780+
"box expression syntax is experimental; you can call `Box::new` instead.";
781+
782+
const EXPLAIN_STMT_ATTR_SYNTAX: &'static str =
783+
"attributes on non-item statements and expressions are experimental.";
784+
812785
pub const EXPLAIN_ASM: &'static str =
813786
"inline assembly is not stable enough for use and is subject to change";
814787

@@ -829,6 +802,9 @@ pub const EXPLAIN_CUSTOM_DERIVE: &'static str =
829802
pub const EXPLAIN_DERIVE_UNDERSCORE: &'static str =
830803
"attributes of the form `#[derive_*]` are reserved for the compiler";
831804

805+
pub const EXPLAIN_PLACEMENT_IN: &'static str =
806+
"placement-in expression syntax is experimental and subject to change.";
807+
832808
struct PostExpansionVisitor<'a> {
833809
context: &'a Context<'a>,
834810
}

0 commit comments

Comments
 (0)