Skip to content

Commit a94e6c7

Browse files
committedJul 16, 2022
Add regression test for rust-lang#95829
Signed-off-by: Yuki Okushi <[email protected]>
1 parent d5e7f47 commit a94e6c7

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed
 

‎src/test/ui/extern/issue-95829.rs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// edition:2018
2+
3+
extern {
4+
async fn L() { //~ ERROR: incorrect function inside `extern` block
5+
//~^ ERROR: functions in `extern` blocks cannot have qualifiers
6+
async fn M() {}
7+
}
8+
}
9+
10+
fn main() {}

‎src/test/ui/extern/issue-95829.stderr

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
error: incorrect function inside `extern` block
2+
--> $DIR/issue-95829.rs:4:14
3+
|
4+
LL | extern {
5+
| ------ `extern` blocks define existing foreign functions and functions inside of them cannot have a body
6+
LL | async fn L() {
7+
| ______________^___-
8+
| | |
9+
| | cannot have a body
10+
LL | |
11+
LL | | async fn M() {}
12+
LL | | }
13+
| |_____- help: remove the invalid body: `;`
14+
|
15+
= help: you might have meant to write a function accessible through FFI, which can be done by writing `extern fn` outside of the `extern` block
16+
= note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html
17+
18+
error: functions in `extern` blocks cannot have qualifiers
19+
--> $DIR/issue-95829.rs:4:14
20+
|
21+
LL | extern {
22+
| ------ in this `extern` block
23+
LL | async fn L() {
24+
| ^
25+
|
26+
help: remove the qualifiers
27+
|
28+
LL | fn L() {
29+
| ~~
30+
31+
error: aborting due to 2 previous errors
32+

0 commit comments

Comments
 (0)
Please sign in to comment.