You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know Edition 2024 is very experimental at the moment, so this is more of a heads-up than an actual issue.
Description
Rust has just implemented RFC 3484, requiring all extern blocks to be marked unsafe extern in Edition 2024. Older editions don't yet compile this unsafe extern construct (as of the latest stable, rustc-1.80.0), but they will eventually accept the unsafe keyword for compatibility reasons. This crate needs some way of generating bindings with this future requirements, either via Builder configuration, or by detecting the current edition.
I've implemented a minimal (but complete) example that triggers the error here: bindgen-unsafe-extern.
It's worth noting that Edition 2024 safe extern functions, plus either the proposed [[safe]] attribute for C (N2659) or an equivalent, would solve #2774.
The proposed [[safe]] attribute did not get enough support from the committee back then, but lately memory safety is talked about more in WG14 and is in the latest charter, so perhaps things change. Rust safe items within unsafe extern blocks could help there.
Or perhaps a C implementation could add something like that to improve interop with Rust for their users... :)
I know Edition 2024 is very experimental at the moment, so this is more of a heads-up than an actual issue.
Description
Rust has just implemented RFC 3484, requiring all
extern
blocks to be markedunsafe extern
in Edition 2024. Older editions don't yet compile thisunsafe extern
construct (as of the latest stable,rustc-1.80.0
), but they will eventually accept theunsafe
keyword for compatibility reasons. This crate needs some way of generating bindings with this future requirements, either viaBuilder
configuration, or by detecting the current edition.I've implemented a minimal (but complete) example that triggers the error here: bindgen-unsafe-extern.
Input C/C++ Header
Bindgen Invocation
Actual Results
Generated file:
Compiler error:
Expected Results
For Edition 2024, the generated file should be:
The text was updated successfully, but these errors were encountered: