-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Tracking Issue for core_ffi_c #94501
Comments
Provide C FFI types via core::ffi, not just in std Tracking issue: rust-lang#94501 The ability to interoperate with C code via FFI is not limited to crates using std; this allows using these types without std. The existing types in `std::os::raw` become type aliases for the ones in `core::ffi`. This uses type aliases rather than re-exports, to allow the std types to remain stable while the core types are unstable. This also moves the currently unstable `NonZero_` variants and `c_size_t`/`c_ssize_t`/`c_ptrdiff_t` types to `core::ffi`, while leaving them unstable. Historically, we didn't do this because these types are target-dependent. However, `core` itself is also target-dependent. `core` should not call any OS services, but it knows the target and the target's ABI.
To clarify, was #94503 able to avoid insta-stability of the new items? There seems to be some confusion as to whether or not type aliases respect stability markers. |
@bstrie It appears so: |
The introductory docs for
So that should probably be modified slightly if we go with this change? (Which I am greatly in favour of btw) |
Should these items also be available in |
@SimonSapin They were, but that was reverted in 07ea143 because it caused breakage; we can re-add it as re-exports when we stabilize this. |
More seriously: I think the key detail here is that core doesn't offer any interfaces to platform functionality; it doesn't call into the platform. I think offering portable types whose layout is platform-specific doesn't invalidate that. |
Following up from Zulip: @rust-lang/libs-api, shall we stabilize the @rfcbot merge |
Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
To be clear, this also includes adding these types to |
@BurntSushi Yes. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon. |
Stabilized in #98315 |
Feature gate:
#![feature(core_ffi_c)]
This is a tracking issue for providing the aliases for C types (
c_int
,c_char
, etc) viacore::ffi
, not just viastd::os::raw
. The ability to interoperate with C code via FFI is not limited to crates usingstd
; this allows using these types withoutstd
.Public API
The existing types in
std::os::raw
will become type aliases for the ones incore::ffi
. This will use type aliases rather than re-exports, to allow the std types to remain stable while the core types are unstable.This also moves the currently unstable
NonZero
variants andc_size_t
/c_ssize_t
/c_ptrdiff_t
types tocore::ffi
, while leaving them unstable.Steps / History
The text was updated successfully, but these errors were encountered: