Skip to content
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

Add resolver = "2" to root Cargo.toml #4357

Closed
Darksonn opened this issue Dec 29, 2021 · 2 comments
Closed

Add resolver = "2" to root Cargo.toml #4357

Darksonn opened this issue Dec 29, 2021 · 2 comments
Labels
A-ci Area: The continuous integration setup

Comments

@Darksonn
Copy link
Contributor

Currently by not enabling the new feature resolver, test features are enabled even when building Tokio in non-test mode. This means e.g. that we never build Tokio with only the fs feature in CI because test-util depends on the rt feature, enabling that too.

Adding the resolver = "2" option to our workspace Cargo.toml fixes the issue on new rustc versions, but it causes our MSRV to emit an error when building Tokio.

@Darksonn Darksonn added the A-ci Area: The continuous integration setup label Dec 29, 2021
@taiki-e
Copy link
Member

taiki-e commented Dec 29, 2021

Currently by not enabling the new feature resolver, test features are enabled even when building Tokio in non-test mode. This means e.g. that we never build Tokio with only the fs feature in CI because test-util depends on the rt feature, enabling that too.

This is due to v1 resolver merging the features of normal dependencies and the dev-dependencies
cargo-hack's --no-dev-deps, --remove-dev-deps, cargo's unstable -Zfeatures=all, -Zfeatures=dev-deps, -Zavoid-dev-deps can handle this issue. (cargo-hack is originally designed to handle these problems that occur with v1 resolvers.)
Our CI already uses one of them, so it works correctly.

run: cargo hack check --all --each-feature -Z avoid-dev-deps

# Remove dev-dependencies from Cargo.toml to prevent the next `cargo update`
# from determining minimal versions based on dev-dependencies.
cargo hack --remove-dev-deps --workspace


Adding the resolver = "2" option to our workspace Cargo.toml fixes the issue on new rustc versions, but it causes our MSRV to emit an error when building Tokio.

AFAIK cargo does not provide a stable way to change the resolver version at runtime, but I think it would be easy to add the ability to do that to cargo-hack.

@Darksonn
Copy link
Contributor Author

Alright, it's good that we are handling it properly. Thanks for verifying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ci Area: The continuous integration setup
Projects
None yet
Development

No branches or pull requests

2 participants