diff options
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/tt/quoted.rs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/libsyntax/ext/tt/quoted.rs b/src/libsyntax/ext/tt/quoted.rs index b56871a1885..43d279980f6 100644 --- a/src/libsyntax/ext/tt/quoted.rs +++ b/src/libsyntax/ext/tt/quoted.rs @@ -474,11 +474,13 @@ where // #1 is a separator and #2 should be a KleepeOp. // (N.B. We need to advance the input iterator.) match parse_kleene_op(input, span) { - // #2 is `?`, which is not allowed as a Kleene op in 2015 edition. + // #2 is `?`, which is not allowed as a Kleene op in 2015 edition, + // but is allowed in the 2018 edition. Ok(Ok((op, op2_span))) if op == KleeneOp::ZeroOrOne => { sess.span_diagnostic .struct_span_err(op2_span, "expected `*` or `+`") - .note("`?` is not a macro repetition operator") + .note("`?` is not a macro repetition operator in the 2015 edition, \ + but is accepted in the 2018 edition") .emit(); // Return a dummy @@ -506,10 +508,12 @@ where Err(_) => op1_span, } } else { - // `?` is not allowed as a Kleene op in 2015 + // `?` is not allowed as a Kleene op in 2015, + // but is allowed in the 2018 edition sess.span_diagnostic .struct_span_err(op1_span, "expected `*` or `+`") - .note("`?` is not a macro repetition operator") + .note("`?` is not a macro repetition operator in the 2015 edition, \ + but is accepted in the 2018 edition") .emit(); // Return a dummy @@ -519,11 +523,13 @@ where // #1 is a separator followed by #2, a KleeneOp Ok(Err((tok, span))) => match parse_kleene_op(input, span) { - // #2 is a `?`, which is not allowed as a Kleene op in 2015 edition. + // #2 is a `?`, which is not allowed as a Kleene op in 2015 edition, + // but is allowed in the 2018 edition Ok(Ok((op, op2_span))) if op == KleeneOp::ZeroOrOne => { sess.span_diagnostic .struct_span_err(op2_span, "expected `*` or `+`") - .note("`?` is not a macro repetition operator") + .note("`?` is not a macro repetition operator in the 2015 edition, \ + but is accepted in the 2018 edition") .emit(); // Return a dummy |
