-
Notifications
You must be signed in to change notification settings - Fork 110
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
Mention the need to define a reasonable MSRV #252
Comments
Linking previous discussions: #123 |
i find |
If we were to add something like this, it should probably start with something like, "If you'd like to define an MSRV, then ..." |
I think users should be encouraged to specify cargo-readable MSRV when it lands: Once this is used in Cargo to resolve dependencies (and it's doable even without Cargo's support via registry replacement feature), the problem will largely solve itself without burdening crate authors with supporting outdated Rust versions. |
This is something that had not occurred to me until now (in fact, I'm not sure if I understood the problem completely!), so it would be immensely important for this page to exist in the guidelines with an explanation of this phenomenon, perhaps even with examples. With that said, I would be inclined to emphasize on the pros and cons of an MSRV, including a possible strategy for choosing when and how to embrace one. |
I agree with what's been said. I think the important part is making sure that there's intent behind what the library author is doing and to have a reference on what can be done when they do desire to support old versions, as well as the reasons for doing and not doing them. I also want to deal with the tooling side so that we can also help authors do what they want to do with intent, such as having warnings when publishing a new version that has a different implicit MSRV than what it was the previous time, and showing in crates.io that it is (like lib.rs does), but those are outside of the scope of providing documentation we can point people at (both authors and people either confused or angry with author's explicit policies). |
Concretely, I'd like to see advice provided for the following situation: Suppose:
Should I put It feels like I should, so as to document my intent, but (if I understand correctly) doing so would also make life less convenient for someone who has reason to use the library with Rust 1.233 right now and would prefer to delay dealing with with any future trouble that causes until it comes. |
To be clear; if a dependency updates to use a newer compiler version in a minor update, that could break the minimum version policy without your crate even updating, correct? If so, then either
So, having a strict MSRV is only really possible in very select circumstances, namely when all dependencies have it. On the other hand, if you have it, you don't impose anything on dependent crates. Maybe the advice should then be: Define a MSRV if
|
I think there's a value in specifying MSRV in Cargo.toml as a warning to users of old compiler — such explicit error is much better than a compilation error that makes rustc babble about nighty features and syntax errors. It may have value someday when Cargo learns to use it for dependency resolution. But apart from that I think maintaining MSRV more than 3 versions behind is a futile excercise. Here's the MSRV data for all crates.io crates:
|
Right, my comment assumed that the MSRV was actually a supported version, but it is a necessary requirement, but possibly not sufficient. |
My own opinion on this is that if you don't have a lock file then you shouldn't be concerned with MSRVs. As far as real utility is concerned they're ceremonious at best. As a library author today you have no tools for managing a MSRV. Until that situation changes and there's real mechanisms for maintaining library toolchain compatibility that's in-line with Rust's release train model and can be applied consistently I don't think we should recommend any particular policy around MSRVs. I don't think that's necessarily the same as deciding to pick and document a specific toolchain in your Cargo.toml and CI though. |
The guideline should make mention of defining a reasonable MSRV, how to go about doing so (explain how to install a specific Rust version using rustup and use it for buildling) and why (edition 2015 crates developed on a recent stable might inadvertently start using a recent API or backwards compatible feature).
Inspired by this conversation https://twitter.com/ekuber/status/1438867907388362757
The text was updated successfully, but these errors were encountered: