For identical code written by hand, ordinarily Rust would warn about the use of a repr(Rust) type in an extern "C" block. Maybe this warning is suppressed in macro-generated code, but anyway changing the block from extern "C" to extern "Rust" would eliminate it. These statics here only exist for interaction with other Rust compilation units, not C.
warning: `extern` block uses type `str`, which is not FFI-safe
--> src/main.rs
|
| static LINKME_START: <[&'static str] as ::linkme::private::Slice>::Element;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
= note: `#[warn(improper_ctypes)]` on by default
= help: consider using `*const u8` and a length instead
= note: string slices have no C equivalent
The generated code for an distributed slice:
currently contains something like:
For identical code written by hand, ordinarily Rust would warn about the use of a repr(Rust) type in an extern "C" block. Maybe this warning is suppressed in macro-generated code, but anyway changing the block from
extern "C"
toextern "Rust"
would eliminate it. These statics here only exist for interaction with other Rust compilation units, not C.