Repository navigation
Add flag to pass MSRV/package.rust-version for use by lints #950
Description
Proposal
Sometimes diagnostics wish to guide users to using newer Rust features, but suggesting them may cause a crate's MSRV to increase. Clippy has machinery to record where lints are only relevant to certain Rust versions. It would be useful to be able to use this for Rust's own lints - however, this requires knowing the current crate's MSRV, which is not currently exposed to rustc (except via CARGO_PKG_RUST_VERSION).
Introducing a MSRV flag to rustc allows Cargo (and any other tools) to pass this information to rustc with a more standard API (which Clippy may additionally benefit from, as it currently parses the environment variable).
Motivating example: rust-lang/rust#149870
Proposed Policy for Usage
- It should be considered a mild bug for a lint to not respect MSRV
- There should be an approximate cutoff point for where we'll accept bugs, such as 1.64 (i.e. we don't want to have hundreds of bugs for lints which don't respect a MSRV of 1.12.0)
- Non-spammy PRs to add MSRV to existing lints will be accepted
- Any new diagnostics which do require a specific Rust version should have their MSRV applied
Process
The main points of the Major Change Process are as follows:
- File an issue describing the proposal.
- A compiler team member who is knowledgeable in the area can second by writing
@rustbot secondor kickoff a team FCP with@rfcbot fcp $RESOLUTION.- Refer to Proposals, Approvals and Stabilization docs for when a second is sufficient, or when a full team FCP is required.
- Once an MCP is seconded, the Final Comment Period begins.
- Final Comment Period lasts for 10 days after all outstanding concerns are solved.
- Outstanding concerns will block the Final Comment Period from finishing. Once all concerns are resolved, the 10 day countdown is restarted.
- If no concerns are raised after 10 days since the resolution of the last outstanding concern, the MCP is considered approved.
You can read more about Major Change Proposals on forge.
Activity
rustbot commentedon Dec 11, 2025
Important
This issue is not meant to be used for technical discussion. There is a Zulip stream for that.
Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.
Concerns or objections can formally be registered here by adding a comment.
Concerns can be lifted with:
See documentation at https://forge.rust-lang.org
[-]Add `-Z msrv=xx.yy.zz` flag[/-][+]Add flag to pass MSRV/`package.rust-version` for use by lints[/+]davidtwco commentedon May 28, 2026
@rustbot second
#t-compiler/meetings > [weekly] 2026-05-28 @ 💬
rustbot commentedon Jun 7, 2026
The final comment period is now complete, this major change is now accepted. 🎉
As the automated representative, I want to express gratitude to the author for their work and everyone else who contributed to this major change proposal.
If you think this major change shouldn't have been accepted, feel free to remove the
major-change-acceptedlabel and reopen this issue.Note
Further progress is now tracked over at rust-lang/rust#157574.