-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable #[deny(improper_ctypes)] #466
Comments
I think this is fine for now because we use same target build on the same platform, or even build one for you own. |
I'm seeing an example here where an array is passed directly as a function argument: Line 362 in 3720f6d
The unsafe code guidelines explicit list array arguments as not FFI safe, and say a pointer to the array needs to be used instead to match the behavior on the C-side. |
Here is an example on godbolt showing the different code Rust generates for pass by value vs pass by reference of an array: https://godbolt.org/z/vhqzv5fee In C/C++ arrays are passed by pointer, so the binding needs to do the same (I guess this is also an upstream bindgen issue) Edit: rust-lang/rust-bindgen#2071 seems to indicate we must blocklist the underlying C++ type, since bindgen is known to not work well for such types. |
I plan to take some time and clean up mozjs (warnings, code, pull request, issues), but this will probably happen in september.
This will require more glue code. |
When building moz-js locally as part of servo I'm getting some warnings about some function parameters not being FFI-safe. Is this a known issue, that can't be worked around?
In my opinion we should deny
improper_ctypes
by default, and perhaps allow certain cases if it really can't be avoided and people are extremely sure that in practice the types are ffi-safe.The text was updated successfully, but these errors were encountered: