diff options
| author | Mark Mansi <markm@cs.wisc.edu> | 2018-01-25 15:23:43 -0600 |
|---|---|---|
| committer | Mark Mansi <markm@cs.wisc.edu> | 2018-01-30 12:41:04 -0600 |
| commit | 51ef7393ef3e55e22cd385bd89dfa2c1b95a659b (patch) | |
| tree | 1396aa1c92b393444e3de56846238fe733a8fb50 /src | |
| parent | f59b821944e52c1158ad921f8b2be1be54039942 (diff) | |
| download | rust-51ef7393ef3e55e22cd385bd89dfa2c1b95a659b.tar.gz rust-51ef7393ef3e55e22cd385bd89dfa2c1b95a659b.zip | |
Fix typo in error message + update tests
Diffstat (limited to 'src')
| -rw-r--r-- | src/libsyntax/ext/tt/quoted.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-39388.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/macro-at-most-once-rep-ambig.rs | 14 | ||||
| -rw-r--r-- | src/test/run-pass/macro-at-most-once-rep.rs | 6 |
4 files changed, 20 insertions, 4 deletions
diff --git a/src/libsyntax/ext/tt/quoted.rs b/src/libsyntax/ext/tt/quoted.rs index 13764ebfca1..670d3614604 100644 --- a/src/libsyntax/ext/tt/quoted.rs +++ b/src/libsyntax/ext/tt/quoted.rs @@ -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) } diff --git a/src/test/compile-fail/issue-39388.rs b/src/test/compile-fail/issue-39388.rs index 15eef429eab..3fbbab62d24 100644 --- a/src/test/compile-fail/issue-39388.rs +++ b/src/test/compile-fail/issue-39388.rs @@ -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)* } } diff --git a/src/test/compile-fail/macro-at-most-once-rep-ambig.rs b/src/test/compile-fail/macro-at-most-once-rep-ambig.rs index b0a6ec145e1..89ca30840a9 100644 --- a/src/test/compile-fail/macro-at-most-once-rep-ambig.rs +++ b/src/test/compile-fail/macro-at-most-once-rep-ambig.rs @@ -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 `?` } - diff --git a/src/test/run-pass/macro-at-most-once-rep.rs b/src/test/run-pass/macro-at-most-once-rep.rs index fa1f90bf6ef..823f42c4544 100644 --- a/src/test/run-pass/macro-at-most-once-rep.rs +++ b/src/test/run-pass/macro-at-most-once-rep.rs @@ -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); |
