make Parser::parse_foreign_item() return a foreign item or error
closes #54441
This commit is contained in:
parent
a57f1c9c95
commit
9da428dad8
5 changed files with 40 additions and 16 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
13
src/test/ui/macros/issue-54441.rs
Normal file
13
src/test/ui/macros/issue-54441.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#![feature(macros_in_extern)]
|
||||
|
||||
macro_rules! m {
|
||||
() => {
|
||||
let //~ ERROR expected
|
||||
};
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
m!();
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
14
src/test/ui/macros/issue-54441.stderr
Normal file
14
src/test/ui/macros/issue-54441.stderr
Normal 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
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue