You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have project in a workspace that has something like the following Cargo.toml:
[package]
name = "bug"version = "0.1.0"edition = "2021"
[dependencies]
[target.'cfg(target_arch="wasm32")'.dependencies]
tokio = { version = "1", features = ["sync"] }
[target.'cfg(not(target_arch="wasm32"))'.dependencies]
tokio = { version = "1", features = ["net"] }
When I was running cargo build --target wasm32-unknown-unknown then Tokio's net feature got enabled too and I was getting compilation errors because of mio crate.
This is an issue only if the project is in a workspace.
docs: raise awareness of resolver used inside workspace
Workspaces by default use the resolver in version 1. It's been some time already since the 2021 edition which made version 2 a default for alone packages, but yet most of the projects that make a use of the workspaces still depends on an old resolver.
By being explicit about the resolver tag inside the workspace we can lower the usage of older resolver for the new projects.
This can raise the awareness of this behavior and prevent issues like #12387. I also wasn't aware of this behavior before while not being so new to Rust, and we have the resolver 2 for good reasons, so I think we should be more explicit about it in the documentation.
When someone looks for the 'how to make cargo workspace' answers, he's unlikely to get to the `Dependency Resolution` section at the same time, he'll likely just copy paste the workspace example from the `Workspaces` and call it a day, yet extending the usage of an old resolver and not benefiting from the new one.
Problem
I have project in a workspace that has something like the following
Cargo.toml
:When I was running
cargo build --target wasm32-unknown-unknown
then Tokio'snet
feature got enabled too and I was getting compilation errors because ofmio
crate.This is an issue only if the project is in a workspace.
Steps
git clone https://github.com/oblique/cargo-features-bug
cargo build --target wasm32-unknown-unknown
Possible Solution(s)
No response
Notes
I created a minimal example: https://github.com/oblique/cargo-features-bug
Version
The text was updated successfully, but these errors were encountered: