-
Notifications
You must be signed in to change notification settings - Fork 58
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
i128/u128 are not FFI safe #119
Comments
Would love to see a conversation around this :) |
This is blocked on resolving rust-lang/rust#54341 - it doesn't really matter what we specify here if we cannot implement it. |
Is there anywhere an official list of types that are FFI-safe? Would be nice to have something to point people to. |
I don't think such a list exists (might want to look at the improper ctypes lint). Also, instead of documenting types that are FFI safe (all types are safe for the |
Is that true? What if you pass ownership of a
The Rust ABI doesn't define what allocator to use, so passing ownership of heap allocated types across an ABI boundary is potentially unsafe, even if the ABI does define what the representation should be. edit: |
Calling an In your particular example, |
(a non-stable implementation detail of Rust on MSVC is that the global allocator is |
Closing. This is not a T-opsem question, it's mostly tracking a compiler bug |
The layout of
i128
/u128
appears to currently be not fully specified due to: rust-lang/rust#54341 and these types are indeed not safe to use in Rust FFI.We probably want to guarantee that their layout matches
__int128
and similar C language extensions in the platforms that expose them, and to say that their alignment is "implementation-defined" in platforms that do not expose these, probably documenting what it is, at least on Tier-1 platforms like Windowsmsvc
targets.The text was updated successfully, but these errors were encountered: