-
Notifications
You must be signed in to change notification settings - Fork 101
Minimum supported Rust version policy? #285
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
Comments
I would make this more of a soft policy. On one hand it's nice to have to have software that will compile with older compilers (although I do not think that "older" compilers are actually a big thing with Rust unlike other languages, due to the stability guarantees and ease of deployment) on the other hand I do expect new Rust versions providing new language features which are very important for us to enable new features or remove ugly workarounds and in that case we do not want to be bound to having to support older compilers for a long time. Why not simply guarantee the operation on the latest version and if we decide to implement something that is not backward compatible, bump the minor version so people need to deliberately opt-in to using the newer compiler version (it also seems somewhat likely that making use of new compiler version features might be a breaking change anyway). |
I agree with @therealprof here, as we want to get rid of workarounds over time. |
Bumping the required compiler / Rust version is a breaking change as per semver (*). I don't think "stop following semver" is up for discussion. This policy is more about limiting the rate of "churn" in the crate ecosystem. To give a concrete example: the (*) Which is why I think that regardless of what policy (if any) we pick here we should (a) document the compiler version support of each crate, (b) have a builder (e.g. |
@japaric I hear you. I still don't think a hard policy is appropriate here; if an important change pops up we want to be able to figure out a reasonable way to adopt it and that includes a whole lot more work and coordination than bumping a crate version. I don't think this will happen very often (probably not more than once, worst case twice a year) but if it happens in two consecutive Rust releases we don't want to be twiddling thumbs and having to wait until our previously fixed policy allows us to do it. I'd say a reasonable policy here would be a mission statement to avoid unnecessary breakage as much as possible and put a minimum supported Rust release bump under the scrutiny of a member discussion and vote for the main crates.
That makes total sense. |
Considering rust version bump as a semver breaking change is not wildly accepted. For example, you can see clap's policy: https://github.com/clap-rs/clap#minimum-version-of-rust IMHO, requiring recent compiler version for embedded is much less problematic than for CLI: CLI are generally integrated in linux distribution via packages, compiled using the rust version present in the package manager. Embedded systems don't have to my knowledge this kind of constraints. Now, you don't want to adopt the newly released stable toolchain without waiting a bit. Supporting the previous stable seems an OK compromise (6 weeks to use the new feature). Now, I'd personally prefer to not break the ecosystem using the semver trick and requiring a more recent toolchain for a pre 1.0.0 patch version. |
How about using the 2018 edition version as the base version on which the lib should work, unless the crate needs features which appeared post 1.31? |
@therealprof in general, not having a policy means we have to explicitly get the whole responsible team together and discuss the change before making a decision. Having a policy means one can just send a PR, say "this follows our established policy" and be done with a single review. Of course, a policy may not be the right call 100% of the time; in those cases we'll have to discuss what to do but that will be a special case so having a policy would still reduce the amount of required coordination. @TeXitoi clap is a 1.0 (2.0, actually) crate. Crates that have reached 1.0 shy away from bumping the major version (semver bump) because that's seen as a Bad Thing (TM) from a branding / marketing / "stability promise" perspective. (Also see pre-1.0 crates, which is what we are discussing, will usually bump the minor version (semver bump) when the minimum supported rust version (MSRV) changes. See https://users.rust-lang.org/t/rust-version-requirement-change-as-semver-breaking-or-not/20980/2
Exactly, and this can be encoded in a policy like "MSRV is never higher than latest stable minus 2" (or 1, or whatever seems appropriate).
Sorry, I'm not sure I completely understand this sentence. Could you give an example of what you mean? @eddyp most of our no_std crates effectively have an MSRV of 1.31 (and 1.30 in some cases) but this is neither documented, tested or guaranteed.
but when should the MSRV be increased? Right after the feature makes it way to the latest stable? Or should we wait a bit? A policy would answer those question. |
Fair enough. In that case my vote would still be on the policy I laid out in #285 (comment), i.e. guarantee only that it compiles with the latest stable and document which version that is and if a change requires a newer stable version we'll note that requirement and bump the minor version to alert users to that fact that this will require a newer rust version. We can easily test for the requirement, too, by simply requesting a specific stable version in the |
I am pro having a MSRV policy to ensure we document and test what the MSRV is for each wg crate. For the time being I wonder if we're best waiting a few releases and seeing how we get on -- so far there's only been zero (or sort of one) Rust stable release since we could compile on stable at all, so we don't really have much experience with how often we might want to bump this or what the ecosystem implications will be. I'd be happy to say "compiles on latest stable for now; re-evaluate MSRV policy in 1 year", or equally happy to say "must compile on 1.31, re-evaluate in 1 year". |
I have written a policy based on the comments so far: #304 |
304: MSRV policy r=japaric a=japaric closes #285 Co-authored-by: Jorge Aparicio <[email protected]>
Now that embedded Rust has reached the stable channel I think we should consider setting an org-level "minimum supported Rust version" policy. By "minimum supported Rust version" I actually mean "how many stable Rust versions should the latest minor version of a (pre-1.0) crate support?".
For example, we could support only the latest stable release; meaning that once a new stable version of Rust, e.g. 1.32, is out we can issue a new minor version of e.g.
cortex-m
that no longer compiles with Rust 1.31 and requires >=1.32 to build. Note that this doesn't necessarily mean that we'll (artificially) bump the required Rust version whenever we release a new minor version; however, the user should be aware that moving to a new minor version of one our crates may require a compiler update if they are using an old stable compiler.I haven't seen a common trend like "we only guarantee that the three latest stable Rust releases are supported by our latest crate release" in the ecosystem but I have seen some crates, like
syn
, that go great lengths to support very old compilers (e.g.syn
supports Rust >=1.15). We could do something like that as well.Thoughts? Should we provide (and document) any guarantee about the Rust versions a crate support? Should we try to make that guarantee uniform across all our crates? What would be a reasonable policy? Last 3 releases (one nightly -> beta -> stable cycle)? 2 (one quarter)? always >=1.31 (>= 2018 edition)?
The text was updated successfully, but these errors were encountered: