Fix typo in error message + update tests
This commit is contained in:
parent
f59b821944
commit
51ef7393ef
4 changed files with 20 additions and 4 deletions
|
|
@ -432,6 +432,6 @@ where
|
|||
};
|
||||
|
||||
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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue