Skip to content

Commit 51ef739

Browse files
committed
Fix typo in error message + update tests
1 parent f59b821 commit 51ef739

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

src/libsyntax/ext/tt/quoted.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,6 @@ where
432432
};
433433

434434
sess.span_diagnostic
435-
.span_err(span, "expected one of: `*`, `+`, or `?`");
435+
.span_err(span, "expected one of: `*`, `+`, or `?`");
436436
(None, KleeneOp::ZeroOrMore)
437437
}

src/test/compile-fail/issue-39388.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#![allow(unused_macros)]
1212

1313
macro_rules! assign {
14-
(($($a:tt)*) = ($($b:tt))*) => { //~ ERROR expected `*` or `+`
14+
(($($a:tt)*) = ($($b:tt))*) => { //~ ERROR 14:22: 14:29: expected one of: `*`, `+`, or `?`
1515
$($a)* = $($b)*
1616
}
1717
}

src/test/compile-fail/macro-at-most-once-rep-ambig.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ macro_rules! foo {
1212
($(a)?) => {}
1313
}
1414

15+
macro_rules! baz {
16+
($(a),?) => {} // comma separator is meaningless for `?`
17+
}
18+
1519
macro_rules! bar {
1620
($(a)?+) => {}
1721
}
@@ -20,7 +24,13 @@ pub fn main() {
2024
foo!(a?a?a); //~ ERROR no rules expected the token `?`
2125
foo!(a?a); //~ ERROR no rules expected the token `?`
2226
foo!(a?); //~ ERROR no rules expected the token `?`
23-
bar!(); //~ ERROR no rules expected the token `)`
27+
baz!(a?a?a); //~ ERROR no rules expected the token `?`
28+
baz!(a?a); //~ ERROR no rules expected the token `?`
29+
baz!(a?); //~ ERROR no rules expected the token `?`
30+
baz!(a,); //~ ERROR no rules expected the token `,`
31+
baz!(a?a?a,); //~ ERROR no rules expected the token `?`
32+
baz!(a?a,); //~ ERROR no rules expected the token `?`
33+
baz!(a?,); //~ ERROR no rules expected the token `?`
34+
bar!(); //~ ERROR unexpected end of macro invocation
2435
bar!(a?); //~ ERROR no rules expected the token `?`
2536
}
26-

src/test/run-pass/macro-at-most-once-rep.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,19 @@ macro_rules! foo {
1212
($(a)?) => {}
1313
}
1414

15+
macro_rules! baz {
16+
($(a),?) => {} // comma separator is meaningless for `?`
17+
}
18+
1519
macro_rules! bar {
1620
($(a)?+) => {}
1721
}
1822

1923
pub fn main() {
2024
foo!();
2125
foo!(a);
26+
baz!();
27+
baz!(a);
2228
bar!(a);
2329
bar!(a?a);
2430
bar!(a?a?a);

0 commit comments

Comments
 (0)