mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-04 09:53:04 +03:00
Fix typo in error message + update tests
This commit is contained in:
@@ -432,6 +432,6 @@ fn parse_sep_and_kleene_op<I>(
|
||||
};
|
||||
|
||||
sess.span_diagnostic
|
||||
.span_err(span, "expected one of: `*`, `+`, or `?`");
|
||||
.span_err(span, "expected one of: `*`, `+`, or `?`");
|
||||
(None, KleeneOp::ZeroOrMore)
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#![allow(unused_macros)]
|
||||
|
||||
macro_rules! assign {
|
||||
(($($a:tt)*) = ($($b:tt))*) => { //~ ERROR expected `*` or `+`
|
||||
(($($a:tt)*) = ($($b:tt))*) => { //~ ERROR 14:22: 14:29: expected one of: `*`, `+`, or `?`
|
||||
$($a)* = $($b)*
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,10 @@ macro_rules! foo {
|
||||
($(a)?) => {}
|
||||
}
|
||||
|
||||
macro_rules! baz {
|
||||
($(a),?) => {} // comma separator is meaningless for `?`
|
||||
}
|
||||
|
||||
macro_rules! bar {
|
||||
($(a)?+) => {}
|
||||
}
|
||||
@@ -20,7 +24,13 @@ pub fn main() {
|
||||
foo!(a?a?a); //~ ERROR no rules expected the token `?`
|
||||
foo!(a?a); //~ ERROR no rules expected the token `?`
|
||||
foo!(a?); //~ ERROR no rules expected the token `?`
|
||||
bar!(); //~ ERROR no rules expected the token `)`
|
||||
baz!(a?a?a); //~ ERROR no rules expected the token `?`
|
||||
baz!(a?a); //~ ERROR no rules expected the token `?`
|
||||
baz!(a?); //~ ERROR no rules expected the token `?`
|
||||
baz!(a,); //~ ERROR no rules expected the token `,`
|
||||
baz!(a?a?a,); //~ ERROR no rules expected the token `?`
|
||||
baz!(a?a,); //~ ERROR no rules expected the token `?`
|
||||
baz!(a?,); //~ ERROR no rules expected the token `?`
|
||||
bar!(); //~ ERROR unexpected end of macro invocation
|
||||
bar!(a?); //~ ERROR no rules expected the token `?`
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,10 @@ macro_rules! foo {
|
||||
($(a)?) => {}
|
||||
}
|
||||
|
||||
macro_rules! baz {
|
||||
($(a),?) => {} // comma separator is meaningless for `?`
|
||||
}
|
||||
|
||||
macro_rules! bar {
|
||||
($(a)?+) => {}
|
||||
}
|
||||
@@ -19,6 +23,8 @@ macro_rules! bar {
|
||||
pub fn main() {
|
||||
foo!();
|
||||
foo!(a);
|
||||
baz!();
|
||||
baz!(a);
|
||||
bar!(a);
|
||||
bar!(a?a);
|
||||
bar!(a?a?a);
|
||||
|
||||
Reference in New Issue
Block a user