Tracking issue for invalid_reference_casting
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
This is a tracking issue for the lint invalid_reference_casting, which was uplifted from Clippy's cast_ref_to_mut lint in https://github.com/rust-lang/rust/pull/111567.
This lint is deny-by-default, i.e. #![deny(invalid_reference_casting)].
Status
This lint was uplifted directly from Clippy, but shortly after that a bug in the lint was reported: https://github.com/rust-lang/rust/issues/124685. Currently we are working on eliminating all forms of this issue.
Steps
- @saethlin is doing some investigation into how this lint is tripped across the ecosystem by crawling crater results.
Open Questions
The lint currently hunts for an expression that represents the backing allocation, then if it encounters a pattern known to produce false positives, we punt on reporting that case. Should we invert the logic and be silent by default instead?
Implementation history
https://github.com/rust-lang/rust/pull/111567
https://github.com/rust-lang/rust/pull/124761
https://github.com/rust-lang/rust/pull/124908
https://github.com/rust-lang/rust/pull/124978
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 linked implementation pull requests, especially the report in issue 124685, and review the crater investigation described here. Done would require addressing the lint's false positives and resolving the open question about whether its reporting logic should be inverted.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100