Skip to content

Commit 42de973

Browse files
Add regression test
1 parent 4865852 commit 42de973

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Regression test for issue #91370.
2+
3+
extern {
4+
//~^ `extern` blocks define existing foreign functions
5+
fn f() {
6+
//~^ incorrect function inside `extern` block
7+
//~| cannot have a body
8+
impl Copy for u8 {}
9+
}
10+
}
11+
12+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
error: incorrect function inside `extern` block
2+
--> $DIR/issue-91370-foreign-fn-block-impl.rs:5:8
3+
|
4+
LL | extern {
5+
| ------ `extern` blocks define existing foreign functions and functions inside of them cannot have a body
6+
LL |
7+
LL | fn f() {
8+
| ________^___-
9+
| | |
10+
| | cannot have a body
11+
LL | |
12+
LL | |
13+
LL | | impl Copy for u8 {}
14+
LL | | }
15+
| |_____- help: remove the invalid body: `;`
16+
|
17+
= 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
18+
= note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html
19+
20+
error: aborting due to previous error
21+

0 commit comments

Comments
 (0)