Document resolver = "2" effective requirement for rust-gpu
Firestar99 opened this issue · comments
Add official documentation that one should have
[workspace]
resolver = "2"
in their root cargo.toml
to make sure dependencies are resolved correctly and that crates compiled with different features on native and spirv don't get merged into one feature set.
An example can be num-traits
which compiles with features default,std
on native and libm
on spirv target.
For a practical example see the issue below:
#986
Official documentation: https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions
I'll also add that if you have both [workspace]
and [package]
in your root Cargo.tool
(i.e. the workspace root is not a "virtual manifest"), then edition = "2021"
inside [package]
should "just work".
So there's 3 avenues to getting the resolver changes, but sadly Cargo doesn't warn users when they have e.g. virtual manifests with per-package edition = "2021"
everywhere but still Rust 2015 behavior.
I've previously mentioned that
[workspace.package]
edition = "2021"
is enough, but that's actually wrong. In this documentation it is stated that resolver="2"
is the only way to specify it in a virtual workspace:
The resolver is a global setting for a workspace, and the setting is ignored in dependencies. The setting is only honored for the top-level package of the workspace. If you are using a virtual workspace, you will still need to explicitly set the resolver field in the [workspace] definition if you want to opt-in to the new resolver.