Keep label on moved spans and point at macro invocation on parse error

This commit is contained in:
Esteban Küber 2018-11-05 16:27:28 -08:00
parent 76449d86c0
commit c45871ba02
7 changed files with 40 additions and 15 deletions

View file

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

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:14:28
--> $DIR/macro-expanded-mod.rs:22:15
|
LL | ($i:ident) => { mod $i; }
| ^
LL | mod_decl!(foo);
| ^^^
error: aborting due to previous error

View file

@ -26,7 +26,12 @@ 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
|
::: $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

View file

@ -26,7 +26,12 @@ 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
|
::: $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

View file

@ -5,7 +5,7 @@ LL | macro_rules! empty { () => () }
| -- in this macro arm
...
LL | _ => { empty!() }
| ^^^^^^^^ in this macro expansion
| ^^^^^^^^ expected expression
error: aborting due to previous error