Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

[enhancement] "false positive" on a complex dependency in libra #165

Open
huitseeker opened this issue Jul 22, 2020 · 0 comments
Open

[enhancement] "false positive" on a complex dependency in libra #165

huitseeker opened this issue Jul 22, 2020 · 0 comments

Comments

@huitseeker
Copy link

huitseeker commented Jul 22, 2020

TL;DR:

cargo-guppy doesn't support the use case of a feature-controlled dependency, and reports both alternatives as dependencies.

This is not really a bug, rather an understandable limitation, because I can't imagine how introspection into manually-built xor-semantics of features (something only made possible by the recent resolver v2) would naturally fall into scope.

The present issue is hence more for awareness, or to advocate for a possible warning inviting a second look on dependencies:

  • marked as optional, and,
  • loaded as part of a feature switch.

Long form:

On PR diem/diem#4970
a crate in Libra switches from having a single dependency source and offering a feature switch for whether an upstream feature therein is activated or not:

[dependencies]
foo = { ... }

[features]
default = [ "bazfeat"]
bazfeat = ["foo/bazfeat"]
barfeat = ["foo/barfeat"]

To having two dependencies and choosing (exclusively) between them using the same sort of feature switch:

[dependencies]
foo = { ..., features = ["bazfeat"], optional = true}
quux = { <some other source for the same dep> , package = 'foo', features = ["barfeat"], optional = true}

[features]
default = [ "bazfeat"]
bazfeat = ["foo"]
barfeat = ["quux"]

Then in code:

#[cfg(feature = "barfeat")]
use quux as foo;

(a later PR makes explicit those are meant to be loaded exclusively)

Upon that change, the following script:
diem/diem#4132

Reports each alternative foo, quux as dependencies, and therefore records this PR as "adding" quux.

cc: @metajack

@huitseeker huitseeker changed the title [enhancement] "false positive" on a complex dependencies in libra [enhancement] "false positive" on a complex dependency in libra Jul 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant