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

"dep:dependency" features are not running with --feature-powerset and without --optional-deps #153

Closed
TimDiekmann opened this issue Jun 25, 2022 · 2 comments · Fixed by #154
Labels
A-features Area: features (--feature-powerset, --each-feature, etc.) C-bug Category: related to a bug.

Comments

@TimDiekmann
Copy link

TimDiekmann commented Jun 25, 2022

I have a Cargo.toml which basically contains

[dependencies]
crate_a = { version = "1.33.7", optional = true }
crate_b = { version = "1.33.8" }
crate_c = { version = "1.33.9", optional = true }

[features]
crate_a = ["dep:crate_a", "crate_b/crate_a"]
great_feature = ["dep:crate_c"]
  • --feature-powerset will not run for --features crate_a
  • --feature-powerset --optional-deps, works with crate_a but also tries to run crate_c which fails because a feature with "dep:crate_c" is specified

Do you see this being fixed somehow? I try to avoid specifying the optional dependencies myself. The optimal solution would probably be that --feature-powerset will "simply" pick up crate-a as well as it's defined int he [features] section.

Without looking at the code I guess that you read all features and exclude them if --optional-deps is not specified and the crate is also an optional dependency?

TimDiekmann added a commit to hashintel/hash that referenced this issue Jun 25, 2022
@taiki-e taiki-e added the C-bug Category: related to a bug. label Jun 25, 2022
@taiki-e
Copy link
Owner

taiki-e commented Jun 25, 2022

Thanks for the report!

Without looking at the code I guess that you read all features and exclude them if --optional-deps is not specified and the crate is also an optional dependency?

Yes. We need to fix this filter:

for name in package.features.keys() {
if !optional_deps.contains(&&**name) {
features.push(name.into());
}
}

(This incomplete filter was originally added to fix breakage after namespaced and weak dependency features stabilization changed the cargo metadata and caused breakage in some projects.)

@taiki-e
Copy link
Owner

taiki-e commented Jul 18, 2022

Fixed in 0.5.15 (#154)

@taiki-e taiki-e added the A-features Area: features (--feature-powerset, --each-feature, etc.) label Jul 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-features Area: features (--feature-powerset, --each-feature, etc.) C-bug Category: related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants