forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// test for #52334 ICE when casting extern "C" fn when it has a non-FFI-safe argument | ||
//@ check-pass | ||
|
||
type Foo = extern "C" fn(::std::ffi::CStr); | ||
//~^ WARN `extern` fn uses type `[i8]`, which is not FFI-safe | ||
extern "C" { | ||
fn meh(blah: Foo); | ||
//~^ WARN `extern` block uses type `[i8]`, which is not FFI-safe | ||
} | ||
|
||
fn main() { | ||
meh as usize; | ||
} |
22 changes: 22 additions & 0 deletions
22
tests/ui/extern/extern-C-non-FFI-safe-arg-ice-52334.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
warning: `extern` fn uses type `[i8]`, which is not FFI-safe | ||
--> $DIR/extern-C-non-FFI-safe-arg-ice-52334.rs:4:12 | ||
| | ||
LL | type Foo = extern "C" fn(::std::ffi::CStr); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe | ||
| | ||
= help: consider using a raw pointer instead | ||
= note: slices have no C equivalent | ||
= note: `#[warn(improper_ctypes_definitions)]` on by default | ||
|
||
warning: `extern` block uses type `[i8]`, which is not FFI-safe | ||
--> $DIR/extern-C-non-FFI-safe-arg-ice-52334.rs:7:18 | ||
| | ||
LL | fn meh(blah: Foo); | ||
| ^^^ not FFI-safe | ||
| | ||
= help: consider using a raw pointer instead | ||
= note: slices have no C equivalent | ||
= note: `#[warn(improper_ctypes)]` on by default | ||
|
||
warning: 2 warnings emitted | ||
|