Skip to content

Inferred MSRV from Edition is misleading since the crate doesn't necessarily support the inferred version #10103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Arnavion opened this issue Nov 28, 2024 · 0 comments · Fixed by #10108
Assignees

Comments

@Arnavion
Copy link

Current Behavior

get msrv() {
let rustVersion = this.rust_version;
if (rustVersion) {
// add `.0` suffix if the `rust-version` field only has two version components
return /^[^.]+\.[^.]+$/.test(rustVersion) ? `${rustVersion}.0` : rustVersion;
} else if (this.edition === '2018') {
return '1.31.0';
} else if (this.edition === '2021') {
return '1.56.0';
} else if (this.edition === '2024') {
return '1.85.0';
}
}

... added by 93f8da5 causes crates.io to show an MSRV of 1.56.0 on all crates that have Edition 2021 and no explicit MSRV. This led to a user filing a bug on one of my crates that it doesn't compile with the old Rust version they wanted to use. I do not support such an old version of Rust for this crate, and it is misleading of crates.io to show 1.56.0 as the "Minimum Supported Rust Version". Only the crate author gets to decide what versions of Rust are and are not supported, and an arbitrary lower bound inferred from the edition does not mean that version is supported.

Expected Behavior

crates.io should only display the value explicitly specified via the rust-version manifest field, and if it isn't present it should display as "Unknown" or something, not a made-up value.

Steps To Reproduce

https://crates.io/crates/k8s-openapi/versions

Image

Environment

N/A

Anything else?

No response

@Turbo87 Turbo87 moved this to For next meeting in crates.io team meetings Nov 29, 2024
@LawnGnome LawnGnome self-assigned this Nov 29, 2024
LawnGnome added a commit to LawnGnome/crates.io that referenced this issue Nov 29, 2024
In rust-lang#9996, we started showing the MSRV based on the edition for crate
versions that declare an edition but not a `rust-version` in their
manifest. This isn't strictly correct: a crate may require features
added later in an edition than in the first Rust version that defined
that edition, and showing this as an MSRV implies a level of support
that the crate author may not have intended.

So, we shouldn't show an MSRV if one isn't declared, but we _can_ show
the edition if one of those is defined. Let's do that.

Fixes rust-lang#10103.
@Turbo87 Turbo87 closed this as completed in 74cddcc Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants