@@ -474,11 +474,13 @@ where
474
474
// #1 is a separator and #2 should be a KleepeOp.
475
475
// (N.B. We need to advance the input iterator.)
476
476
match parse_kleene_op ( input, span) {
477
- // #2 is `?`, which is not allowed as a Kleene op in 2015 edition.
477
+ // #2 is `?`, which is not allowed as a Kleene op in 2015 edition,
478
+ // but is allowed in the 2018 edition.
478
479
Ok ( Ok ( ( op, op2_span) ) ) if op == KleeneOp :: ZeroOrOne => {
479
480
sess. span_diagnostic
480
481
. struct_span_err ( op2_span, "expected `*` or `+`" )
481
- . note ( "`?` is not a macro repetition operator" )
482
+ . note ( "`?` is not a macro repetition operator in the 2015 edition, \
483
+ but is accepted in the 2018 edition")
482
484
. emit ( ) ;
483
485
484
486
// Return a dummy
@@ -506,10 +508,12 @@ where
506
508
Err ( _) => op1_span,
507
509
}
508
510
} else {
509
- // `?` is not allowed as a Kleene op in 2015
511
+ // `?` is not allowed as a Kleene op in 2015,
512
+ // but is allowed in the 2018 edition
510
513
sess. span_diagnostic
511
514
. struct_span_err ( op1_span, "expected `*` or `+`" )
512
- . note ( "`?` is not a macro repetition operator" )
515
+ . note ( "`?` is not a macro repetition operator in the 2015 edition, \
516
+ but is accepted in the 2018 edition")
513
517
. emit ( ) ;
514
518
515
519
// Return a dummy
@@ -519,11 +523,13 @@ where
519
523
520
524
// #1 is a separator followed by #2, a KleeneOp
521
525
Ok ( Err ( ( tok, span) ) ) => match parse_kleene_op ( input, span) {
522
- // #2 is a `?`, which is not allowed as a Kleene op in 2015 edition.
526
+ // #2 is a `?`, which is not allowed as a Kleene op in 2015 edition,
527
+ // but is allowed in the 2018 edition
523
528
Ok ( Ok ( ( op, op2_span) ) ) if op == KleeneOp :: ZeroOrOne => {
524
529
sess. span_diagnostic
525
530
. struct_span_err ( op2_span, "expected `*` or `+`" )
526
- . note ( "`?` is not a macro repetition operator" )
531
+ . note ( "`?` is not a macro repetition operator in the 2015 edition, \
532
+ but is accepted in the 2018 edition")
527
533
. emit ( ) ;
528
534
529
535
// Return a dummy
0 commit comments