rust-lang / rust-lang/rust-clippy
New lint: casting &mut T to &mut MaybeUninit<T> and exposing it as safe
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
As discussed at several different places, the pattern of casting &mut T to &mut MaybeUninit<T> or &mut [T] to &mut [MaybeUninit<T>] and exposing it as safe is reoccurring (see bellow), so making Correctness lint would help.
IDK if there's any policy about clippy suggesting particular crates, but if this is allowed, maybe suggest possibly_uninit.
- Doc issue at
rust bytesis unsounduninitcrate is unsoundpossibly_uninitwas almost made unsound but I realized it and fixed it before it was too late. :)
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
Begin by reviewing the linked Rust documentation issue, bytes issue, and uninit discussion to compare the recurring unsafe patterns. Then determine the scope of a Clippy correctness lint and whether it may suggest possibly_uninit; done means those casts are diagnosed with appropriate coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100