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

Cargo Resolver V2 (different feature sets for build and runtime dependencies) is not supported #38

Open
Shnatsel opened this issue Jul 29, 2022 · 1 comment
Labels
bug Something isn't working third party Work item for a third-party dependency

Comments

@Shnatsel
Copy link
Member

Shnatsel commented Jul 29, 2022

Cargo has made it possible to depend on the same version of a given crate with different feature sets, provided that one version is a runtime dependency and another is a build dependency.

The dependency resolution in rust-audit was written prior to that change, and it's possible that auditable-serde collates these two packages.

The deduplication is done on the package ID from cargo-metadata, and we'll need to double-check that this is in fact correct even in the presence of the new Cargo feature resolver:

https://github.com/Shnatsel/rust-audit/blob/d7fa6fff1861799adab41638267e0457b7ba4698/auditable-serde/src/lib.rs#L219

@Shnatsel Shnatsel changed the title Double-check dependency resolution against latest Cargo Double-check dependency resolution against latest Cargo (Resolver V2) Aug 8, 2022
@Shnatsel Shnatsel changed the title Double-check dependency resolution against latest Cargo (Resolver V2) Cargo Resolver V2 (different feature sets for dev and runtime dependencies) is not supported Oct 11, 2022
@Shnatsel Shnatsel added the third party Work item for a third-party dependency label Oct 11, 2022
@Shnatsel
Copy link
Member Author

cargo metadata doesn't support Resolver V2: rust-lang/cargo#10718

So unfortunately we're stuck with potentially reporting more dependencies than what actually went into the build if all of the below are true:

  1. The same package is used as both build/runtime and development dependency
  2. The package has more features enabled when used as a development dependency than when used as a runtime dependency
  3. The package's features enabled only when used as a dev dependency pull in additional dependencies not present in the runtime dependency tree

@Shnatsel Shnatsel added the bug Something isn't working label Oct 11, 2022
@Shnatsel Shnatsel changed the title Cargo Resolver V2 (different feature sets for dev and runtime dependencies) is not supported Cargo Resolver V2 (different feature sets for build and runtime dependencies) is not supported Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working third party Work item for a third-party dependency
Projects
None yet
Development

No branches or pull requests

1 participant