Skip to content

Transitively resolving a crate dependency when its features are required #1871

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

Closed
mlalic opened this issue Aug 3, 2015 · 0 comments · Fixed by #1873
Closed

Transitively resolving a crate dependency when its features are required #1871

mlalic opened this issue Aug 3, 2015 · 0 comments · Fixed by #1873

Comments

@mlalic
Copy link

mlalic commented Aug 3, 2015

Given the following section of a Cargo.toml file:

[dependencies.openssl]
version = "*"
features = ["tlsv1_2", "npn"]
optional = true

[features]
tls = ["openssl/tlsv1_2", "openssl/npn"]

Previously (i.e. in the beta and stable channels), when attempting to build the project with

$ cargo build --features="tls"

it would correctly compile and automatically include the openssl crate (along with the two requested features, of course) as a dependency.

In the nightly channel (cargo 0.4.0-nightly (553b363 2015-08-03) (built 2015-08-02)), however, this isn't the case... It seems that a dependency isn't included as an --extern flag to rustc when its features are requested, without specifying the crate too, which leads to a compilation error once the extern crate openssl is encountered in the source.

Explicitly adding the crate to the feature's dependencies (i.e. tls = ["openssl", "openssl/tlsv1_2", "openssl/npn"]) fixes the issue, but this seems to be a regression, rather than expected behavior?

For an example of a crate affected by this, see this Travis build.

alexcrichton added a commit to alexcrichton/cargo that referenced this issue Aug 3, 2015
When activating the feature `foo/bar` you're actually activating both the
feature `foo` and the `bar` feature of the relevant package. Cargo previously
forgot to activate the `foo` feature, and this commit fixes that up.

Closes rust-lang#1871
bors added a commit that referenced this issue Aug 3, 2015
When activating the feature `foo/bar` you're actually activating both the
feature `foo` and the `bar` feature of the relevant package. Cargo previously
forgot to activate the `foo` feature, and this commit fixes that up.

Closes #1871
@bors bors closed this as completed in #1873 Aug 3, 2015
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