remove feature gate

This commit is contained in:
Mark Mansi 2018-11-24 16:12:16 -06:00
parent c75ed34732
commit a542e48871
2 changed files with 7 additions and 42 deletions

View file

@ -576,22 +576,7 @@ where
let span = match parse_kleene_op(input, span) {
// #1 is a `?` (needs feature gate)
Ok(Ok((op, op1_span))) if op == KleeneOp::ZeroOrOne => {
if !features.macro_at_most_once_rep
&& !attr::contains_name(attrs, "allow_internal_unstable")
{
let explain = feature_gate::EXPLAIN_MACRO_AT_MOST_ONCE_REP;
emit_feature_err(
sess,
"macro_at_most_once_rep",
op1_span,
GateIssue::Language,
explain,
);
op1_span
} else {
return (None, op);
}
return (None, op);
}
// #1 is a `+` or `*` KleeneOp
@ -602,22 +587,10 @@ where
// #2 is the `?` Kleene op, which does not take a separator (error)
Ok(Ok((op, op2_span))) if op == KleeneOp::ZeroOrOne => {
// Error!
if !features.macro_at_most_once_rep
&& !attr::contains_name(attrs, "allow_internal_unstable")
{
// FIXME: when `?` as a Kleene op is stabilized, we only need the "does not
// take a macro separator" error (i.e. the `else` case).
sess.span_diagnostic
.struct_span_err(op2_span, "expected `*` or `+`")
.note("`?` is not a macro repetition operator")
.emit();
} else {
sess.span_diagnostic.span_err(
span,
"the `?` macro repetition operator does not take a separator",
);
}
sess.span_diagnostic.span_err(
span,
"the `?` macro repetition operator does not take a separator",
);
// Return a dummy
return (None, KleeneOp::ZeroOrMore);
@ -638,13 +611,8 @@ where
};
// If we ever get to this point, we have experienced an "unexpected token" error
if !features.macro_at_most_once_rep && !attr::contains_name(attrs, "allow_internal_unstable") {
sess.span_diagnostic.span_err(span, "expected `*` or `+`");
} else {
sess.span_diagnostic
.span_err(span, "expected one of: `*`, `+`, or `?`");
}
sess.span_diagnostic
.span_err(span, "expected one of: `*`, `+`, or `?`");
// Return a dummy
(None, KleeneOp::ZeroOrMore)

View file

@ -1426,9 +1426,6 @@ pub const EXPLAIN_DERIVE_UNDERSCORE: &'static str =
pub const EXPLAIN_UNSIZED_TUPLE_COERCION: &'static str =
"unsized tuple coercion is not stable enough for use and is subject to change";
pub const EXPLAIN_MACRO_AT_MOST_ONCE_REP: &'static str =
"using the `?` macro Kleene operator for \"at most one\" repetition is unstable";
struct PostExpansionVisitor<'a> {
context: &'a Context<'a>,
}