-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
unsafe extern
support (undocumented_unsafe_blocks
?)
#13560
Comments
In light of #13777, which addresses |
When writing the blocks manually, then one may for instance give a general statement in the In such a case, it would be important to have a way to tell Clippy to not lint about unnecessary safety comments inside. For instance: // SAFETY: (... why the signatures are correct ...). In addition,
// for `safe` items, please see the safety comments inside.
unsafe extern {
// SAFETY: (.. why `safe` is fine here ...).
pub safe fn f();
} Other projects may want to explain individually why particular signatures are correct though, e.g. if reasons differ. Though they could also use multiple blocks. Now, when using a tool like However, the tool may also provide a way to understand which items can be marked This came up in rust-lang/rust-bindgen#3058 (comment). |
What it does
Rust 1.80.0 allows writing
unsafe extern
underfeature(unsafe_extern_blocks)
, Rust 1.82.0 stabilizes it, and Edition 2024 will require it. Thus it would be nice to have a lint that ensures// SAFETY
comments are in place.undocumented_unsafe_blocks
covers not justunsafe
blocks (at least currently), so it could make sense to put it there, but it may make more sense to avoid adding more things into that one.Advantage
No response
Drawbacks
No response
Example
Should be written as:
The text was updated successfully, but these errors were encountered: