Navigation Menu

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

Fix bug with features and optional dependencies #45

Merged
merged 5 commits into from Oct 28, 2022
Merged

Fix bug with features and optional dependencies #45

merged 5 commits into from Oct 28, 2022

Conversation

Jake-Shadle
Copy link
Member

@Jake-Shadle Jake-Shadle commented Oct 27, 2022

This fixes a bug where the fix for #41 was...not correct, and would erroneously prune out optional dependencies if the feature that brought them in did not exactly match their name, which was somehow a case I didn't run across testing.

This can be seen in, for example, wasmtime.

[dependencies]
wasmtime-cranelift = { workspace = true, optional = true }
rayon = { version = "1.0", optional = true }

[features]
cranelift = ["dep:wasmtime-cranelift"]
parallel-compilation = ["dep:rayon"]

The bug was that since both wasmtime-cranelift and rayon were marked as optional, the code would attempt to locate wasmtime-cranelift in the features and fail, so now it properly looks to see if the any of the enabled features have subfeatures that enable the exact package id, getting rid of the broken name comparison.

This also adds Krate::direct_dependencies for the same reason as having direct_dependents

@Jake-Shadle Jake-Shadle merged commit 461260f into main Oct 28, 2022
@Jake-Shadle Jake-Shadle deleted the fix branch October 28, 2022 11:46
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 this pull request may close these issues.

None yet

1 participant