mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 06:22:00 +00:00
parent
548e14b439
commit
14d05c4c4b
13
tests/ui/extern/extern-C-non-FFI-safe-arg-ice-52334.rs
vendored
Normal file
13
tests/ui/extern/extern-C-non-FFI-safe-arg-ice-52334.rs
vendored
Normal file
@ -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
tests/ui/extern/extern-C-non-FFI-safe-arg-ice-52334.stderr
vendored
Normal file
22
tests/ui/extern/extern-C-non-FFI-safe-arg-ice-52334.stderr
vendored
Normal file
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user