mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 00:34:06 +00:00
b335ec9ec8
Instead of saying to "consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct", we now tell users to "Use `*const ffi::c_char` instead, and pass the value from `CStr::as_ptr()`" when the type involved is a `CStr` or a `CString`. Co-authored-by: Jieyou Xu <jieyouxu@outlook.com>
23 lines
880 B
Plaintext
23 lines
880 B
Plaintext
warning: `extern` fn uses type `CStr`, which is not FFI-safe
|
|
--> $DIR/extern-C-non-FFI-safe-arg-ice-52334.rs:7:12
|
|
|
|
|
LL | type Foo = extern "C" fn(::std::ffi::CStr);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
|
|
|
|
= help: consider passing a `*const std::ffi::c_char` instead, and use `CStr::as_ptr()`
|
|
= note: `CStr`/`CString` do not have a guaranteed layout
|
|
= note: `#[warn(improper_ctypes_definitions)]` on by default
|
|
|
|
warning: `extern` block uses type `CStr`, which is not FFI-safe
|
|
--> $DIR/extern-C-non-FFI-safe-arg-ice-52334.rs:10:18
|
|
|
|
|
LL | fn meh(blah: Foo);
|
|
| ^^^ not FFI-safe
|
|
|
|
|
= help: consider passing a `*const std::ffi::c_char` instead, and use `CStr::as_ptr()`
|
|
= note: `CStr`/`CString` do not have a guaranteed layout
|
|
= note: `#[warn(improper_ctypes)]` on by default
|
|
|
|
warning: 2 warnings emitted
|
|
|