Fix ignoring optional deps when namespaced deps are used. #241
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thanks for making
cargo-hack
!I've been lately incorporating it into the Linebender CI that we use across a bunch of projects. Its
--workspace
and--each-feature
functionalities have been especially useful.When I was trying out the new CI script for our Kurbo project I found that
cargo-hack
does not handle Kurbo's optional dependecies (e.g.libm
) correctly. That is with--optional-deps
and even with--features libm
. Upon looking closer I identified thatcargo-hack
is not behaving correctly because Kurbo makes use of namespaced dependencies.In this PR I redesigned the
namespaced_features
test to be more comprehensive and better match what Cargo does.The old test incorrectly stated:
Cargo does not treat optional dependencies as implicit features only when that specific dependency has been referenced with the
dep:
prefix in an explicit feature. All other optional dependencies remain implicit features as before.The actual code changes to get the test to pass were luckily minimal.