Point at end of macro arm when encountering EOF

Fix #52866
This commit is contained in:
Esteban Küber 2018-10-25 10:09:19 -07:00
parent 910ec6d97f
commit ea9ccb6046
8 changed files with 34 additions and 17 deletions

View file

@ -12,6 +12,7 @@
macro_rules! mod_decl {
($i:ident) => { mod $i; }
//~^ ERROR Cannot declare a non-inline module inside a block
}
mod macro_expanded_mod_helper {
@ -19,5 +20,5 @@ mod macro_expanded_mod_helper {
}
fn main() {
mod_decl!(foo); //~ ERROR Cannot declare a non-inline module inside a block
mod_decl!(foo);
}

View file

@ -1,8 +1,8 @@
error: Cannot declare a non-inline module inside a block unless it has a path attribute
--> $DIR/macro-expanded-mod.rs:22:15
--> $DIR/macro-expanded-mod.rs:14:28
|
LL | mod_decl!(foo); //~ ERROR Cannot declare a non-inline module inside a block
| ^^^
LL | ($i:ident) => { mod $i; }
| ^
error: aborting due to previous error

View file

@ -22,11 +22,11 @@ error: no rules expected the token `async`
LL | r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async`
| ^^^^^ no rules expected the token `async`
error: expected one of `move`, `|`, or `||`, found `<eof>`
--> <::edition_kw_macro_2015::passes_ident macros>:1:22
error: expected one of `move`, `|`, or `||`, found the end of the macro arm
--> <::edition_kw_macro_2015::passes_ident macros>:1:25
|
LL | ( $ i : ident ) => ( $ i )
| ^^^ expected one of `move`, `|`, or `||` here
| ^
error: aborting due to 5 previous errors

View file

@ -22,11 +22,11 @@ error: no rules expected the token `async`
LL | r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async`
| ^^^^^ no rules expected the token `async`
error: expected one of `move`, `|`, or `||`, found `<eof>`
--> <::edition_kw_macro_2018::passes_ident macros>:1:22
error: expected one of `move`, `|`, or `||`, found the end of the macro arm
--> <::edition_kw_macro_2018::passes_ident macros>:1:25
|
LL | ( $ i : ident ) => ( $ i )
| ^^^ expected one of `move`, `|`, or `||` here
| ^
error: aborting due to 5 previous errors

View file

@ -41,13 +41,13 @@ LL | barplus!(); //~ERROR unexpected end of macro invocation
| ^^^^^^^^^^^ unexpected end of macro invocation
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
| ^ unexpected end of macro invocation
error: no rules expected the token `?`
--> $DIR/macro-at-most-once-rep-2018.rs:42:15
@ -77,13 +77,13 @@ LL | barstar!(); //~ERROR unexpected end of macro invocation
| ^^^^^^^^^^^ unexpected end of macro invocation
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
| ^ unexpected end of macro invocation
error: no rules expected the token `?`
--> $DIR/macro-at-most-once-rep-2018.rs:49:15

View file

@ -1,4 +1,4 @@
error: expected expression, found `<eof>`
error: expected expression, found the end of the macro arm
--> $DIR/macro-in-expression-context-2.rs:5:16
|
LL | _ => { empty!() }