Tweak macro parse errors when reaching EOF during macro call parse

- Add detail on origin of current parser when reaching EOF and stop
  saying "found <eof>" and point at the end of macro calls
- Handle empty `cfg_attr` attribute
- Reword empty `derive` attribute error
This commit is contained in:
Esteban Küber
2019-05-21 17:47:23 -07:00
parent fc45382c12
commit 24160171e4
21 changed files with 176 additions and 93 deletions

View File

@@ -12,17 +12,17 @@ error: expected expression, found keyword `struct`
LL | format!(struct);
| ^^^^^^ expected expression
error: expected expression, found `<eof>`
--> $DIR/format-parse-errors.rs:4:23
error: expected expression, found end of macro arguments
--> $DIR/format-parse-errors.rs:4:24
|
LL | format!("s", name =);
| ^ expected expression
| ^ expected expression
error: expected `=`, found `<eof>`
--> $DIR/format-parse-errors.rs:5:29
error: expected `=`, found end of macro arguments
--> $DIR/format-parse-errors.rs:5:32
|
LL | format!("s", foo = foo, bar);
| ^^^ expected `=`
| ^ expected `=`
error: expected expression, found keyword `struct`
--> $DIR/format-parse-errors.rs:6:24