make Parser::parse_foreign_item() return a foreign item or error

closes #54441
This commit is contained in:
Austin Bonander 2018-10-03 14:24:31 -07:00
parent a57f1c9c95
commit 9da428dad8
5 changed files with 40 additions and 16 deletions

View file

@ -10,7 +10,7 @@
// compile-flags: -Z parse-only
// error-pattern:expected one of `(`, `fn`, `static`, `type`, or `}` here
// error-pattern:expected one of `(`, `fn`, `static`, or `type`
extern {
pub pub fn foo();
}

View file

@ -0,0 +1,13 @@
#![feature(macros_in_extern)]
macro_rules! m {
() => {
let //~ ERROR expected
};
}
extern "C" {
m!();
}
fn main() {}

View file

@ -0,0 +1,14 @@
error: expected one of `crate`, `fn`, `pub`, `static`, or `type`, found `let`
--> $DIR/issue-54441.rs:5:9
|
LL | #![feature(macros_in_extern)]
| - expected one of `crate`, `fn`, `pub`, `static`, or `type` here
...
LL | let //~ ERROR expected
| ^^^ unexpected token
...
LL | m!();
| ----- in this macro invocation
error: aborting due to previous error