Auto merge of #55402 - estebank:macro-eof-2, r=nikomatsakis
Point at end of macro arm when encountering EOF Fix #52866.
This commit is contained in:
commit
10e2c729ea
25 changed files with 130 additions and 65 deletions
|
|
@ -46,8 +46,8 @@ fn expand_mbe_matches(cx: &mut ExtCtxt, _: Span, args: &[TokenTree])
|
|||
NodeId::from_u32(0));
|
||||
let map = match TokenTree::parse(cx, &mbe_matcher, args.iter().cloned().collect()) {
|
||||
Success(map) => map,
|
||||
Failure(_, tok) => {
|
||||
panic!("expected Success, but got Failure: {}", parse_failure_msg(tok));
|
||||
Failure(_, tok, msg) => {
|
||||
panic!("expected Success, but got Failure: {} - {}", parse_failure_msg(tok), msg);
|
||||
}
|
||||
Error(_, s) => {
|
||||
panic!("expected Success, but got Error: {}", s);
|
||||
|
|
|
|||
|
|
@ -19,5 +19,6 @@ mod macro_expanded_mod_helper {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
mod_decl!(foo); //~ ERROR Cannot declare a non-inline module inside a block
|
||||
mod_decl!(foo);
|
||||
//~^ ERROR Cannot declare a non-inline module inside a block
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
error: Cannot declare a non-inline module inside a block unless it has a path attribute
|
||||
--> $DIR/macro-expanded-mod.rs:22:15
|
||||
|
|
||||
LL | mod_decl!(foo); //~ ERROR Cannot declare a non-inline module inside a block
|
||||
LL | mod_decl!(foo);
|
||||
| ^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@ error: no rules expected the token `r#async`
|
|||
--> $DIR/edition-keywords-2015-2015-parsing.rs:22:31
|
||||
|
|
||||
LL | r#async = consumes_async!(r#async); //~ ERROR no rules expected the token `r#async`
|
||||
| ^^^^^^^ no rules expected the token `r#async`
|
||||
| ^^^^^^^ no rules expected this token in macro call
|
||||
|
||||
error: no rules expected the token `async`
|
||||
--> $DIR/edition-keywords-2015-2015-parsing.rs:23:35
|
||||
|
|
||||
LL | r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async`
|
||||
| ^^^^^ no rules expected the token `async`
|
||||
| ^^^^^ no rules expected this token in macro call
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@ error: no rules expected the token `r#async`
|
|||
--> $DIR/edition-keywords-2015-2018-parsing.rs:22:31
|
||||
|
|
||||
LL | r#async = consumes_async!(r#async); //~ ERROR no rules expected the token `r#async`
|
||||
| ^^^^^^^ no rules expected the token `r#async`
|
||||
| ^^^^^^^ no rules expected this token in macro call
|
||||
|
||||
error: no rules expected the token `async`
|
||||
--> $DIR/edition-keywords-2015-2018-parsing.rs:23:35
|
||||
|
|
||||
LL | r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async`
|
||||
| ^^^^^ no rules expected the token `async`
|
||||
| ^^^^^ no rules expected this token in macro call
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -14,19 +14,24 @@ error: no rules expected the token `r#async`
|
|||
--> $DIR/edition-keywords-2018-2015-parsing.rs:22:31
|
||||
|
|
||||
LL | r#async = consumes_async!(r#async); //~ ERROR no rules expected the token `r#async`
|
||||
| ^^^^^^^ no rules expected the token `r#async`
|
||||
| ^^^^^^^ no rules expected this token in macro call
|
||||
|
||||
error: no rules expected the token `async`
|
||||
--> $DIR/edition-keywords-2018-2015-parsing.rs:23:35
|
||||
|
|
||||
LL | r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async`
|
||||
| ^^^^^ no rules expected the token `async`
|
||||
| ^^^^^ no rules expected this token in macro call
|
||||
|
||||
error: expected one of `move`, `|`, or `||`, found `<eof>`
|
||||
--> <::edition_kw_macro_2015::passes_ident macros>:1:22
|
||||
error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||`
|
||||
--> <::edition_kw_macro_2015::passes_ident macros>:1:25
|
||||
|
|
||||
LL | ( $ i : ident ) => ( $ i )
|
||||
| ^^^ expected one of `move`, `|`, or `||` here
|
||||
| ^ expected one of `move`, `|`, or `||` here
|
||||
|
|
||||
::: $DIR/edition-keywords-2018-2015-parsing.rs:26:8
|
||||
|
|
||||
LL | if passes_ident!(async) == 1 {}
|
||||
| -------------------- in this macro invocation
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -14,19 +14,24 @@ error: no rules expected the token `r#async`
|
|||
--> $DIR/edition-keywords-2018-2018-parsing.rs:22:31
|
||||
|
|
||||
LL | r#async = consumes_async!(r#async); //~ ERROR no rules expected the token `r#async`
|
||||
| ^^^^^^^ no rules expected the token `r#async`
|
||||
| ^^^^^^^ no rules expected this token in macro call
|
||||
|
||||
error: no rules expected the token `async`
|
||||
--> $DIR/edition-keywords-2018-2018-parsing.rs:23:35
|
||||
|
|
||||
LL | r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async`
|
||||
| ^^^^^ no rules expected the token `async`
|
||||
| ^^^^^ no rules expected this token in macro call
|
||||
|
||||
error: expected one of `move`, `|`, or `||`, found `<eof>`
|
||||
--> <::edition_kw_macro_2018::passes_ident macros>:1:22
|
||||
error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||`
|
||||
--> <::edition_kw_macro_2018::passes_ident macros>:1:25
|
||||
|
|
||||
LL | ( $ i : ident ) => ( $ i )
|
||||
| ^^^ expected one of `move`, `|`, or `||` here
|
||||
| ^ expected one of `move`, `|`, or `||` here
|
||||
|
|
||||
::: $DIR/edition-keywords-2018-2018-parsing.rs:26:8
|
||||
|
|
||||
LL | if passes_ident!(async) == 1 {}
|
||||
| -------------------- in this macro invocation
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ LL | macro_rules! one_arg_macro {
|
|||
| -------------------------- when calling this macro
|
||||
...
|
||||
LL | one_arg_macro!(/**/); //~ ERROR unexpected end
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ unexpected end of macro invocation
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ missing tokens in macro arguments
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ error: no rules expected the token `@`
|
|||
--> $DIR/fail-simple.rs:12:12
|
||||
|
|
||||
LL | panic!(@); //~ ERROR no rules expected the token `@`
|
||||
| ^ no rules expected the token `@`
|
||||
| ^ no rules expected this token in macro call
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ LL | macro_rules! one_arg_macro {
|
|||
| -------------------------- when calling this macro
|
||||
...
|
||||
LL | one_arg_macro!();
|
||||
| ^^^^^^^^^^^^^^^^^ unexpected end of macro invocation
|
||||
| ^^^^^^^^^^^^^^^^^ missing tokens in macro arguments
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ error: unexpected end of macro invocation
|
|||
--> $DIR/issue-7970b.rs:13:1
|
||||
|
|
||||
LL | macro_rules! test {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^^^^^^^^^^^^ missing tokens in macro arguments
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ LL | macro_rules! foo {
|
|||
| ---------------- when calling this macro
|
||||
...
|
||||
LL | foo!(a?); //~ ERROR no rules expected the token `?`
|
||||
| ^ no rules expected the token `?`
|
||||
| ^ no rules expected this token in macro call
|
||||
|
||||
error: no rules expected the token `?`
|
||||
--> $DIR/macro-at-most-once-rep-2018-feature-gate.rs:42:11
|
||||
|
|
@ -64,7 +64,7 @@ LL | macro_rules! foo {
|
|||
| ---------------- when calling this macro
|
||||
...
|
||||
LL | foo!(a?a); //~ ERROR no rules expected the token `?`
|
||||
| ^ no rules expected the token `?`
|
||||
| ^ no rules expected this token in macro call
|
||||
|
||||
error: no rules expected the token `?`
|
||||
--> $DIR/macro-at-most-once-rep-2018-feature-gate.rs:43:11
|
||||
|
|
@ -73,7 +73,7 @@ LL | macro_rules! foo {
|
|||
| ---------------- when calling this macro
|
||||
...
|
||||
LL | foo!(a?a?a); //~ ERROR no rules expected the token `?`
|
||||
| ^ no rules expected the token `?`
|
||||
| ^ no rules expected this token in macro call
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ LL | macro_rules! foo {
|
|||
| ---------------- when calling this macro
|
||||
...
|
||||
LL | foo!(a?); //~ ERROR no rules expected the token `?`
|
||||
| ^ no rules expected the token `?`
|
||||
| ^ no rules expected this token in macro call
|
||||
|
||||
error: no rules expected the token `?`
|
||||
--> $DIR/macro-at-most-once-rep-2018.rs:37:11
|
||||
|
|
@ -20,7 +20,7 @@ LL | macro_rules! foo {
|
|||
| ---------------- when calling this macro
|
||||
...
|
||||
LL | foo!(a?a); //~ ERROR no rules expected the token `?`
|
||||
| ^ no rules expected the token `?`
|
||||
| ^ no rules expected this token in macro call
|
||||
|
||||
error: no rules expected the token `?`
|
||||
--> $DIR/macro-at-most-once-rep-2018.rs:38:11
|
||||
|
|
@ -29,7 +29,7 @@ LL | macro_rules! foo {
|
|||
| ---------------- when calling this macro
|
||||
...
|
||||
LL | foo!(a?a?a); //~ ERROR no rules expected the token `?`
|
||||
| ^ no rules expected the token `?`
|
||||
| ^ no rules expected this token in macro call
|
||||
|
||||
error: unexpected end of macro invocation
|
||||
--> $DIR/macro-at-most-once-rep-2018.rs:40:5
|
||||
|
|
@ -38,16 +38,16 @@ LL | macro_rules! barplus {
|
|||
| -------------------- when calling this macro
|
||||
...
|
||||
LL | barplus!(); //~ERROR unexpected end of macro invocation
|
||||
| ^^^^^^^^^^^ unexpected end of macro invocation
|
||||
| ^^^^^^^^^^^ missing tokens in macro arguments
|
||||
|
||||
error: unexpected end of macro invocation
|
||||
--> $DIR/macro-at-most-once-rep-2018.rs:41:14
|
||||
--> $DIR/macro-at-most-once-rep-2018.rs:41:15
|
||||
|
|
||||
LL | macro_rules! barplus {
|
||||
| -------------------- when calling this macro
|
||||
...
|
||||
LL | barplus!(a); //~ERROR unexpected end of macro invocation
|
||||
| ^ unexpected end of macro invocation
|
||||
| ^ missing tokens in macro arguments
|
||||
|
||||
error: no rules expected the token `?`
|
||||
--> $DIR/macro-at-most-once-rep-2018.rs:42:15
|
||||
|
|
@ -56,7 +56,7 @@ LL | macro_rules! barplus {
|
|||
| -------------------- when calling this macro
|
||||
...
|
||||
LL | barplus!(a?); //~ ERROR no rules expected the token `?`
|
||||
| ^ no rules expected the token `?`
|
||||
| ^ no rules expected this token in macro call
|
||||
|
||||
error: no rules expected the token `?`
|
||||
--> $DIR/macro-at-most-once-rep-2018.rs:43:15
|
||||
|
|
@ -65,7 +65,7 @@ LL | macro_rules! barplus {
|
|||
| -------------------- when calling this macro
|
||||
...
|
||||
LL | barplus!(a?a); //~ ERROR no rules expected the token `?`
|
||||
| ^ no rules expected the token `?`
|
||||
| ^ no rules expected this token in macro call
|
||||
|
||||
error: unexpected end of macro invocation
|
||||
--> $DIR/macro-at-most-once-rep-2018.rs:47:5
|
||||
|
|
@ -74,16 +74,16 @@ LL | macro_rules! barstar {
|
|||
| -------------------- when calling this macro
|
||||
...
|
||||
LL | barstar!(); //~ERROR unexpected end of macro invocation
|
||||
| ^^^^^^^^^^^ unexpected end of macro invocation
|
||||
| ^^^^^^^^^^^ missing tokens in macro arguments
|
||||
|
||||
error: unexpected end of macro invocation
|
||||
--> $DIR/macro-at-most-once-rep-2018.rs:48:14
|
||||
--> $DIR/macro-at-most-once-rep-2018.rs:48:15
|
||||
|
|
||||
LL | macro_rules! barstar {
|
||||
| -------------------- when calling this macro
|
||||
...
|
||||
LL | barstar!(a); //~ERROR unexpected end of macro invocation
|
||||
| ^ unexpected end of macro invocation
|
||||
| ^ missing tokens in macro arguments
|
||||
|
||||
error: no rules expected the token `?`
|
||||
--> $DIR/macro-at-most-once-rep-2018.rs:49:15
|
||||
|
|
@ -92,7 +92,7 @@ LL | macro_rules! barstar {
|
|||
| -------------------- when calling this macro
|
||||
...
|
||||
LL | barstar!(a?); //~ ERROR no rules expected the token `?`
|
||||
| ^ no rules expected the token `?`
|
||||
| ^ no rules expected this token in macro call
|
||||
|
||||
error: no rules expected the token `?`
|
||||
--> $DIR/macro-at-most-once-rep-2018.rs:50:15
|
||||
|
|
@ -101,7 +101,7 @@ LL | macro_rules! barstar {
|
|||
| -------------------- when calling this macro
|
||||
...
|
||||
LL | barstar!(a?a); //~ ERROR no rules expected the token `?`
|
||||
| ^ no rules expected the token `?`
|
||||
| ^ no rules expected this token in macro call
|
||||
|
||||
error: aborting due to 12 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
error: expected expression, found `<eof>`
|
||||
error: macro expansion ends with an incomplete expression: expected expression
|
||||
--> $DIR/macro-in-expression-context-2.rs:5:16
|
||||
|
|
||||
LL | macro_rules! empty { () => () }
|
||||
| -- in this macro arm
|
||||
...
|
||||
LL | _ => { empty!() }
|
||||
| ^^^^^^^^
|
||||
| ^^^^^^^^ expected expression
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ LL | macro_rules! m { ($x:lifetime) => { } }
|
|||
| -------------- when calling this macro
|
||||
...
|
||||
LL | m!(a);
|
||||
| ^ no rules expected the token `a`
|
||||
| ^ no rules expected this token in macro call
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ LL | macro_rules! foo {
|
|||
| ---------------- when calling this macro
|
||||
...
|
||||
LL | foo!(a b);
|
||||
| -^ no rules expected the token `b`
|
||||
| -^ no rules expected this token in macro call
|
||||
| |
|
||||
| help: missing comma here
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ LL | macro_rules! foo {
|
|||
| ---------------- when calling this macro
|
||||
...
|
||||
LL | foo!(a, b, c, d e);
|
||||
| -^ no rules expected the token `e`
|
||||
| -^ no rules expected this token in macro call
|
||||
| |
|
||||
| help: missing comma here
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ LL | macro_rules! foo {
|
|||
| ---------------- when calling this macro
|
||||
...
|
||||
LL | foo!(a, b, c d, e);
|
||||
| -^ no rules expected the token `d`
|
||||
| -^ no rules expected this token in macro call
|
||||
| |
|
||||
| help: missing comma here
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ LL | macro_rules! foo {
|
|||
| ---------------- when calling this macro
|
||||
...
|
||||
LL | foo!(a, b, c d e);
|
||||
| ^ no rules expected the token `d`
|
||||
| ^ no rules expected this token in macro call
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ error: no rules expected the token `enum E { }`
|
|||
--> $DIR/nonterminal-matching.rs:29:10
|
||||
|
|
||||
LL | n!(a $nt_item b); //~ ERROR no rules expected the token `enum E { }`
|
||||
| ^^^^^^^^ no rules expected the token `enum E { }`
|
||||
| ^^^^^^^^ no rules expected this token in macro call
|
||||
...
|
||||
LL | complex_nonterminal!(enum E {});
|
||||
| -------------------------------- in this macro invocation
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ LL | macro_rules! my_faulty_macro {
|
|||
| ---------------------------- when calling this macro
|
||||
LL | () => {
|
||||
LL | my_faulty_macro!(bcd); //~ ERROR no rules
|
||||
| ^^^ no rules expected the token `bcd`
|
||||
| ^^^ no rules expected this token in macro call
|
||||
...
|
||||
LL | my_faulty_macro!();
|
||||
| ------------------- in this macro invocation
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ LL | macro_rules! outer {
|
|||
| ------------------ when calling this macro
|
||||
...
|
||||
LL | //! Inner
|
||||
| ^^^^^^^^^ no rules expected the token `!`
|
||||
| ^^^^^^^^^ no rules expected this token in macro call
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ LL | macro_rules! inner {
|
|||
| ------------------ when calling this macro
|
||||
...
|
||||
LL | /// Outer
|
||||
| ^ no rules expected the token `[`
|
||||
| ^ no rules expected this token in macro call
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ LL | macro_rules! identity {
|
|||
| --------------------- when calling this macro
|
||||
...
|
||||
LL | let identity!(_) = 10; //~ ERROR no rules expected the token `_`
|
||||
| ^ no rules expected the token `_`
|
||||
| ^ no rules expected this token in macro call
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ error: no rules expected the token `,`
|
|||
--> $DIR/vec-macro-with-comma-only.rs:12:10
|
||||
|
|
||||
LL | vec![,]; //~ ERROR no rules expected the token `,`
|
||||
| ^ no rules expected the token `,`
|
||||
| ^ no rules expected this token in macro call
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue