Don't allow array types in extern "C" functions. #24578
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-FFI
Area: Foreign function interface (FFI)
A-lints
Area: Lints (warnings about flaws in source code) such as unused_mut.
C-bug
Category: This is a bug.
E-easy
Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
P-low
Low priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
(imported from improperly closed bug #16221)
You cannot pass an array to or return an array from a C function.
The signature
f(char x[N])
is equivalent tof(char *x)
for everyN
in C. Therefore it is meaningless to write this in Rust, (or rather, it does not mean what a C programmer and/or FFI generation tool likely thinks it means):Option for dealing with this:
extern "C" fn
form reject this signature, since the expected correspondence between Rust and C does not hold here.The text was updated successfully, but these errors were encountered: