parser: introduce parse_item_kind as central ItemInfo logic.

this also extracts macro item parsers.
This commit is contained in:
Mazdak Farrokhzad 2020-01-31 08:37:09 +01:00
parent 511dfdb8b3
commit 73d5970cdc
3 changed files with 172 additions and 201 deletions

View file

@ -1,3 +1,2 @@
#![feature(pub_restricted)]
pub(crate) () fn foo() {} //~ unmatched visibility
//~^ ERROR expected item, found `(`

View file

@ -1,8 +1,16 @@
error: unmatched visibility `pub`
--> $DIR/pub-restricted-error-fn.rs:3:10
--> $DIR/pub-restricted-error-fn.rs:1:1
|
LL | pub(crate) () fn foo() {}
| ^
| ^^^^^^^^^^ the unmatched visibility
|
= help: you likely meant to define an item, e.g., `pub fn foo() {}`
error: aborting due to previous error
error: expected item, found `(`
--> $DIR/pub-restricted-error-fn.rs:1:12
|
LL | pub(crate) () fn foo() {}
| ^ expected item
error: aborting due to 2 previous errors