Thanks @retep998 and @bluss!
So with that out of the way, I feel like @alexcrichton’s arguments against putting types in core don’t apply to c_void, which happens to be the only type for which the location matters.
Thus, if we want to solve this problem quickly and with minimal pain and commitment, the most plausible routes seem to be one of the following:
- Introducing a
ctypes crate under std with all of std::os::raw in it.
- Adding
c_void alone to core, which doesn’t require weighing in on various C issues but solves the main problem.
If we are motivated to remove std::os::raw from std (perhaps for the reasons @alexcrichton laid out), I think the ctypes approach is the best solution. We could take the following steps:
- Introduce the
ctypes crate into the Rust distro, and make std re-export its definitions in std::os::raw.
- Update
libc to also re-export those types, with a minor version bump.
- Note: this is a bit tricky since it requires a particular version of the Rust distro to work; we’d probably need some way to deal with that, either via detection or feature flags.
- Now, the world of
libc and std::os::raw types are fully compatible, solving the original problem.
- At this point, we can safely deprecate
std::os::raw in favor of ctypes, and perhaps at some later date remove those deprecations in a major version of Rust.
- This deprecation no longer causes massive pain, because you can switch to the
libc (or ctypes) definitions without breakage.
Thoughts?