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

Dependencies are pulled in even if behind a feature #1805

Closed
twittner opened this issue Jul 14, 2015 · 0 comments · Fixed by #1812
Closed

Dependencies are pulled in even if behind a feature #1805

twittner opened this issue Jul 14, 2015 · 0 comments · Fixed by #1812

Comments

@twittner
Copy link

If an optional, feature-activated dependency is also listed under dev-dependencies it will be pulled in by cargo build even without the feature being requested:

[package]
name    = "test"
version = "0.1.0"
authors = ["[email protected]"]

[features]
foo = ["quickcheck"]

[dependencies.quickcheck]
optional = true

[dev-dependencies]
quickcheck = "*"
$ cargo build
   Compiling libc v0.1.8
   Compiling rand v0.3.8
   Compiling log v0.3.1
   Compiling quickcheck v0.2.20
   Compiling test v0.1.0 (file:///tmp/test)

Removing the dev-dependencies section builds the package as expected:

$ cargo clean
$ cargo build
   Compiling test v0.1.0 (file:///tmp/test)

Edit: cargo is at version 0.4.0-nightly (15b497b 2015-07-08) (built 2015-07-12)

alexcrichton added a commit to alexcrichton/cargo that referenced this issue Jul 17, 2015
Development dependencies are traversed during the resolution process, causing
them to be returned as the list of dependencies for a package in terms of
resolution. The compilation phase would then filter these out depending on the
dependency's transitivity, but this was incorrectly accounted for when the
dependency showed up multiple times in a few lists.

This commit fixes this behavior by updating the filtering logic to ensure that
only activated optional dependencies (those whose feature names are listed) are
compiled.

Closes rust-lang#1805
bors added a commit that referenced this issue Jul 17, 2015
Development dependencies are traversed during the resolution process, causing
them to be returned as the list of dependencies for a package in terms of
resolution. The compilation phase would then filter these out depending on the
dependency's transitivity, but this was incorrectly accounted for when the
dependency showed up multiple times in a few lists.

This commit fixes this behavior by updating the filtering logic to ensure that
only activated optional dependencies (those whose feature names are listed) are
compiled.

Closes #1805
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant