-
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
Resolver did not set to 2 by default in workspaces #9956
Labels
Comments
Thanks for the report! I have posted rust-lang/edition-guide#267 to try to clarify how this works. Cargo currently doesn't allow setting a global edition for a virtual workspace. That is tracked in #5784. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem
I have a cargo workspace with 2 packages, all set to edition = "2021". However, this do not set to use the resolver 2 by default, which is misleading.
This can be solved by setting
resolver = "2"
in workspaceCargo.toml
(not in the packageCargo.toml
) manually, but this is misleading as one would expect usingedition = "2021"
will set resolver default to be 2.setting resolver = "2" directly in the package does generate an warning:
warning: resolver for the non root package will be ignored, specify resolver at the workspace root:
.The rust 2021 edition guide says:
edition = "2021" implies resolver = "2" in Cargo.toml.
, but this is simply not true in the case of workspace; andedition
do not work in workspaceCargo.toml
as well.Steps
Cargo.toml:
dev-resolver/Cargo.toml
cargo build
.getrandom
is compiled.Set
resolver = "2"
in workspaceCargo.toml
thencargo build
,getrandom
is not compiled.Possible Solution(s)
This have to be add in the documentation.
For rust 2021 (and thus nightly), I suggest to set this automatically (i.e. workspace resolver by default uses resolver 2).
Notes
Output of
cargo version
:cargo 1.57.0-nightly (0121d66aa 2021-09-22)
The text was updated successfully, but these errors were encountered: