Open
Description
Spawned off of this zulip thread.
Given the following code:
extern {
fn __enzyme_autodiff(_: usize, a: &[f32], d_a: &mut [f32]);
}
The current output is:
warning: `extern` block uses type `[f32]`, which is not FFI-safe
--> src/lib.rs:2:39
|
2 | fn __enzyme_autodiff(_: usize, a: &[f32], d_a: &mut [f32]);
| ^^^^^^ not FFI-safe
|
= note: `#[warn(improper_ctypes)]` on by default
= help: consider using a raw pointer instead
= note: slices have no C equivalent
warning: `extern` block uses type `[f32]`, which is not FFI-safe
--> src/lib.rs:2:52
|
2 | fn __enzyme_autodiff(_: usize, a: &[f32], d_a: &mut [f32]);
| ^^^^^^^^^^ not FFI-safe
|
= help: consider using a raw pointer instead
= note: slices have no C equivalent
warning: 2 warnings emitted
Ideally the output should look like:
warning: `extern` block uses type `[f32]`, which is not FFI-safe
--> src/lib.rs:2:39
|
2 | fn __enzyme_autodiff(_: usize, a: &[f32], d_a: &mut [f32]);
| ^^^^^^ not FFI-safe
|
= note: `#[warn(improper_ctypes)]` on by default
= help: consider using a raw pointer instead
= note: slices have no C equivalent, and their ABI is unstable
warning: `extern` block uses type `[f32]`, which is not FFI-safe
--> src/lib.rs:2:52
|
2 | fn __enzyme_autodiff(_: usize, a: &[f32], d_a: &mut [f32]);
| ^^^^^^^^^^ not FFI-safe
|
= help: consider using a raw pointer instead
= note: slices have no C equivalent, and their ABI is unstable
warning: 2 warnings emitted
Why: Currently, people might reverse-engineer the current ABI, and use a Rust type in an extern "C"
block despite the warning. Reminding the reader that the ABI is unstable will help discourage that practice.