-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
pakcage.resolver = "2"
is implicitly inherited when cargo package
, failing the crate build with MSRV 1.50 or older
#14192
Comments
I remember dtolnay brought this up somewhere but I don't remember where. Part of the problem is you are requesting a feature for a higher MSRV and it can be hard to tell if its relevant. In theory, we could say its only relevant if a bin or example is present but thats not always the case. Sometimes those are "private". |
Cargo recommends people to set I feel that the resolver V3 will have the same nasty papercut when stable. Haven't checked the logic though. |
We've had some talk about providing warnings (using #12235) when using features that require a newer MSRV. This is one of the cases I've had in mind.
in my mind, the general intention is we want to push people to set the resolver to their edition (unless they want something otherwise) which would have them match their MSRV already. In #12235, I've noted that we want to expand on the |
#11047 reminded me of one of my concerns for auto-stripping of this:
|
@weihanglo should we close in favor of #11047 and instead decide if we want to re-open that to avoid splitting the conversation further? |
Sounds good to me. |
Problem
When one runs
cargo package
to produce a.crate
tarball for a package withpackage.rust-version = "1.50"
or older, it is expected to work with toolchain of the set MSRV. However, if the package is within a workspace and that workspace has set2
or newer version to theworkspace.resolver
field, it'll automatically inherit from it, failing builds on the toolchain of the MSRV.The
resolver
field is a feature stabilized since 1.51.Steps
workspace.resolver = "2"
package.rust-version = "1.50"
cargo +1.78.0 package
Cargo.toml
in the.crate
source tarball and found thatpackage.resolver = "2"
, which is not compatible with 1.50 MSRV.Possible Solution(s)
Don't inherit
workspace.resolver
when packaging/publishing crates. The resolver behavior is a workspace level setting. The value set in dependency Cargo.toml will be ignored. This might not be ideal because people might wantresolver
set with the same value from the workspace.One alternative is don't inherit if
package.rust-version
is set with a value older than 1.51.0Notes
I forgot if we've talked about this to be honest…
Version
The behavior appears to happen since 1.64.0 when workspace inheritance was introduced.
The text was updated successfully, but these errors were encountered: