mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-16 04:55:22 +03:00
remove feature gate
This commit is contained in:
@@ -576,22 +576,7 @@ fn parse_sep_and_kleene_op_2018<I>(
|
||||
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 @@ fn parse_sep_and_kleene_op_2018<I>(
|
||||
// #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 @@ fn parse_sep_and_kleene_op_2018<I>(
|
||||
};
|
||||
|
||||
// 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)
|
||||
|
||||
@@ -1426,9 +1426,6 @@ fn leveled_feature_err<'a>(sess: &'a ParseSess, feature: &str, span: Span, issue
|
||||
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>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user