fix(bindeps): do not propagate artifact dependency to proc macro or build deps #15788
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 the pull request 🎉!
Please read the contribution guide: https://doc.crates.io/contrib/.
What does this PR try to resolve?
This PR fixes a bug for the nightly feature
bindeps. Basically, iffoohas an artifact dependencyartifactwith a specified target TARGET_ARTIFACT different from host TARGET_HOST,artifactdepends on proc macromacro,macroconditionally depends onarchon TARGET_HOST,cargo build would panic on TARGET_HOST with the following error message:
Similar panic happens when
foohas an artifact dependencyartifactwith a specified target TARGET_ARTIFACT different from host TARGET_HOST,artifacthas a build dependencybuilder,builderconditionally depends onarchon TARGET_HOST.From the above message, it is clear that proc macro
macrowas wrongly associated withFeaturesFor::ArtifactDepinstead ofFeaturesFor::HostDep. Packagearchwas later ignored because cargo thoughtmacroshould be built for TARGET_ARTIFACT (x86_64-apple-darwin), whilearchwas conditionally needed on TARGET_HOST (aarch64-apple-darwin).Similar analyses apply to the other test case.
This commit fixes 2 paths:
FeaturesFor::HostDep.How to test and review this PR?
This PR contains 2 commits
#[should_panic]#[should_panic]from the 2 test cases.cargo testcan pass on each commit.