rust-lang / rust-lang/rust-clippy
`unsafe extern` support (`undocumented_unsafe_blocks`?)
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
What it does
Rust 1.80.0 allows writing unsafe extern under feature(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 just unsafe 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
unsafe extern {}
Should be written as:
// SAFETY: ...
unsafe extern {}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing undocumented_unsafe_blocks lint and the issue's unsafe_extern_blocks feature context. Determine whether unsafe extern blocks should be covered by that lint or a separate lint, then define the expected diagnostic for an unsafe extern block without a // SAFETY comment; done means the design and behavior are settled and covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100