-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
std c_void
and libc c_void
are different types
#31536
Comments
This is an unresolved question in the design of libc, and it's mostly a libc-specific issue, so I'm going to close in favor of rust-lang/libc#180 Which is to say that the current setup is indeed intentional, and in light of rust-lang/rfcs#1415 if |
libc bindings desperately need a single source of truth. Can |
std depending on in-tree libc only enables conflicts between different versions of libc. |
As long as you insist this is a libc bug only, we can't have a nice solution. Can you point me to why we cannot define these types in some subcrate of libstd? |
We've avoided having these types in libcore, and this basically has to be a libc change as Do you have a concrete plan of action in mind though that affects libstd? |
yes, c_void is stable, but it can move to libcore. |
The libs team decided recently that due to how libcore stabilization and interoperability with libstd works we need to be quite careful about stabilizing items in libcore. We also agreed that there needs to be motivation for moving an item to libcore as opposed to simply "this works currently". I would personally not view this as strong enough motivation as to me the If you'd like to have a discussion about moving |
Perhaps whenever |
An std-using crate could easily wind up using no_std libc. |
I think there is a good case for moving these types into libcore to support FFI with freestanding C code which does not use a libc. This is mainly relevant for embedded and/or kernel code, which will be using no_std and will not be able to use the libc crate. This will also help with removing libstd's dependency on libc on Windows, since most remaining uses of libc in libstd/sys/windows are just the basic C types. |
Related internals discussion: https://internals.rust-lang.org/t/solve-std-os-raw-c-void/3268 |
I left some thoughts on the internals discussion. |
See discussions about libc: * rust-lang/rust#31536 * rust-lang/libc#180 * rust-lang/libc#547
New RFC to propose fixing this through |
The RFC was merged, implemented, so this should be closed, probably. |
Indeed! |
Using libc v0.2.7 and rustc 1.8.0-nightly (34af2de 2016-02-05)
These must be compatible, otherwise we cause incompatibilities in the ecosystem.
The text was updated successfully, but these errors were encountered: