Skip to content

Commit 7bd907f

Browse files
committed
Changing error message to reflect changes with the 2018 edition
Signed-off-by: Adonis <[email protected]> Update src/libsyntax/ext/tt/quoted.rs Co-Authored-By: asettouf <[email protected]> Update src/libsyntax/ext/tt/quoted.rs Co-Authored-By: asettouf <[email protected]> Update src/libsyntax/ext/tt/quoted.rs Co-Authored-By: asettouf <[email protected]> Update src/libsyntax/ext/tt/quoted.rs Co-Authored-By: asettouf <[email protected]> Update src/libsyntax/ext/tt/quoted.rs Co-Authored-By: asettouf <[email protected]> Update src/libsyntax/ext/tt/quoted.rs Co-Authored-By: asettouf <[email protected]> Update src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.stderr Co-Authored-By: asettouf <[email protected]> Update src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.stderr Co-Authored-By: asettouf <[email protected]> Stabilize split_ascii_whitespace Tracking issue FCP to merge: rust-lang#48656 (comment) fix stabilization order of uniform_paths. hir: add HirId to main Hir nodes Fix `std::os::fortanix_sgx::usercalls::raw::UsercallNrs` Fixes fortanix/rust-sgx#88 Update src/libsyntax/ext/tt/quoted.rs Co-Authored-By: asettouf <[email protected]> Revert "Merge remote-tracking branch 'upstream/master'" This reverts commit 751f05bd155e2c55d4177fe8211df634faf3a644, reversing changes made to 545a3e62b0cb473108869a61b271bc589afb49da.
1 parent 3d35a9b commit 7bd907f

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

src/libsyntax/ext/tt/quoted.rs

+12-6
Original file line numberDiff line numberDiff line change
@@ -474,11 +474,13 @@ where
474474
// #1 is a separator and #2 should be a KleepeOp.
475475
// (N.B. We need to advance the input iterator.)
476476
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.
478479
Ok(Ok((op, op2_span))) if op == KleeneOp::ZeroOrOne => {
479480
sess.span_diagnostic
480481
.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")
482484
.emit();
483485

484486
// Return a dummy
@@ -506,10 +508,12 @@ where
506508
Err(_) => op1_span,
507509
}
508510
} 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
510513
sess.span_diagnostic
511514
.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")
513517
.emit();
514518

515519
// Return a dummy
@@ -519,11 +523,13 @@ where
519523

520524
// #1 is a separator followed by #2, a KleeneOp
521525
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
523528
Ok(Ok((op, op2_span))) if op == KleeneOp::ZeroOrOne => {
524529
sess.span_diagnostic
525530
.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")
527533
.emit();
528534

529535
// Return a dummy

src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ error: expected `*` or `+`
44
LL | ($(a)?) => {} //~ERROR expected `*` or `+`
55
| ^
66
|
7-
= note: `?` is not a macro repetition operator
7+
= note: `?` is not a macro repetition operator in the 2015 edition, but is accepted in the 2018 edition
88

99
error: expected `*` or `+`
1010
--> $DIR/macro-at-most-once-rep-2015-ques-rep.rs:10:11
1111
|
1212
LL | ($(a),?) => {} //~ERROR expected `*` or `+`
1313
| ^
1414
|
15-
= note: `?` is not a macro repetition operator
15+
= note: `?` is not a macro repetition operator in the 2015 edition, but is accepted in the 2018 edition
1616

1717
error: aborting due to 2 previous errors
1818

0 commit comments

Comments
 (0)