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
Problem
The zvariant crate, when downloaded from crates.io fails on cargo test because of unresolved imports to zvariant_derive. Turns out that cargo automatically strips dev-dependencies that have path, but do not have version. I believe that when there are both, cargo keeps the dependency, but strips path. I did not test it with dependency (non-dev one) since I don't know some easy way to reproduce it but I believe that cargo used to reject those at some point.
Steps
curl -sL https://crates.io/api/v1/crates/zvariant/2.0.0/download#/zvariant-2.0.0.crate | tar -xzO 'zvariant-2.0.0/Cargo.toml' | grep zvariant_derive
(no output)
curl -sL https://crates.io/api/v1/crates/zvariant/2.0.0/download#/zvariant-2.0.0.crate | tar -xzO 'zvariant-2.0.0/Cargo.toml.orig' | grep zvariant_derive
zvariant_derive = { path = "../zvariant_derive" }
Possible Solution(s)
I think such crates should be prohibited from publishing and giving a hint that specifying version should fix the problem.
This is intentional (see #7333). The package will need to specify the version for it to work. This will also be addressed by rust-lang/rfcs#2906 which will automatically inject the version.
It should not have been really allowed to release on crates.io without
this.
References: rust-lang/cargo#8268
Signed-off-by: Igor Raits <[email protected]>
Problem
The zvariant crate, when downloaded from crates.io fails on
cargo test
because of unresolved imports tozvariant_derive
. Turns out that cargo automatically strips dev-dependencies that havepath
, but do not haveversion
. I believe that when there are both, cargo keeps the dependency, but stripspath
. I did not test it withdependency
(non-dev one) since I don't know some easy way to reproduce it but I believe that cargo used to reject those at some point.Steps
curl -sL https://crates.io/api/v1/crates/zvariant/2.0.0/download#/zvariant-2.0.0.crate | tar -xzO 'zvariant-2.0.0/Cargo.toml' | grep zvariant_derive
curl -sL https://crates.io/api/v1/crates/zvariant/2.0.0/download#/zvariant-2.0.0.crate | tar -xzO 'zvariant-2.0.0/Cargo.toml.orig' | grep zvariant_derive
Possible Solution(s)
I think such crates should be prohibited from publishing and giving a hint that specifying
version
should fix the problem.Notes
Output of
cargo version
:installed via rustup.
cc @zeenix
The text was updated successfully, but these errors were encountered: