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
When using [workspace.dependencies] and foo = { workspace = true }, resolver v2 doesn't seem to correctly load only the features for the current target. Everything works fine if the package version is specified directly in the subcrate.
Then if the crate is built with cargo build --target wasm32-unknown-unknown, foo will fail to build because it tries to compile wasm-incompatible code.
At the same time, the following works as expected:
[target.'cfg(not(target_arch="wasm32"))'.dependencies]
foo = { version = "1.2.3" }
[target.'cfg(target_arch="wasm32")'.dependencies]
foo = { version = "1.2.3", default-features = false }
Steps
Create a workspace with a [workspace.dependencies] field. I only tested this on a non-virtual workspace (one with a "root" crate). Add async-tar-wasm = "0.4.2-wasm.1".
Create a subcrate in that workspace with the following:
Thank you for the issue report. This is the expected behavior as features are additive. The workspace dependency didn't opt-out default features, so inherited dependencies cannot get it off.
We made an improvement and will ship in the next version . See the changelog of 1.69 . This comment #11409 (comment) also summarize each combination very well.
Problem
When using
[workspace.dependencies]
andfoo = { workspace = true }
, resolver v2 doesn't seem to correctly load only the features for the current target. Everything works fine if the package version is specified directly in the subcrate.For example, given this
Cargo.toml
:Then if the crate is built with
cargo build --target wasm32-unknown-unknown
,foo
will fail to build because it tries to compile wasm-incompatible code.At the same time, the following works as expected:
Steps
Create a workspace with a
[workspace.dependencies]
field. I only tested this on a non-virtual workspace (one with a "root" crate). Addasync-tar-wasm = "0.4.2-wasm.1"
.Create a subcrate in that workspace with the following:
cargo build --target wasm32-unknown-unknown
Possible Solution(s)
No response
Notes
No response
Version
The text was updated successfully, but these errors were encountered: