rust-lang / rust-lang/rust-clippy
feature request: `#[feature]` awareness in MSRV-gated lints
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Some lints, such as borrow_as_ptr have conditional behavior based on MSRV: https://github.com/rust-lang/rust-clippy/blob/fe4dd5b92e603555594b9abef58405fc9f4f260e/clippy_lints/src/casts/borrow_as_ptr.rs#L31
In Rust-for-Linux, this is not sufficient because we enable a number of unstable features when we are reasonably confident their behavior won't change before stabilization, or because we know they have been stabilized without API change in a version that exceeds our configured MSRV.
It would be extremely helpful if these MSRV checks could be taught to also respect #[feature] attributes that enable unstable features ahead of the MSRV having been met. This is especially tricky when API has actually changed between the configured MSRV and the feature's actual stabilization.
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 with the MSRV-gated logic in clippy_lints/src/casts/borrow_as_ptr.rs and review the configured MSRV in .clippy.toml. Compare this with the Rust-for-Linux #[feature] attributes and account for cases where an API changed before stabilization. Done means relevant lints correctly consider enabled unstable features without assuming incompatible APIs.
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
- 35/100