cargo
cargo copied to clipboard
fix: proc-macro example from dep no longer affects feature resolution
What does this PR try to resolve?
Previously when checking if a dependency is a proc-macro,
the v2 feature resolve resolver v2 looks for proc-macro = true
for every target of the dependency.
However, it's impossible to depend on a non-lib target as a proc-macro.
This fix switches to only check if proc-macro = true for [lib]
target for a dependency.
Fixes https://github.com/rust-lang/cargo/issues/13726.
How should we test and review this PR?
Best reviewed commit-by-commit.
Additional information
I didn't really fix the discrepancy between the behavior of example lib and the documentation, which was mentioned in https://github.com/rust-lang/cargo/issues/13726#issuecomment-2101941480.
Thanks @torhovland for the minimal test case.
r? @epage
rustbot has assigned @epage. They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.
Use r? to explicitly pick a reviewer
@bors r+
:pushpin: Commit 0ead10eebf3a92a9734050da2eb3c3aed07f93e3 has been approved by epage
It is now in the queue for this repository.
:hourglass: Testing commit 0ead10eebf3a92a9734050da2eb3c3aed07f93e3 with merge cc34b84eadff412559abcaaca0770e32050c3b35...
:sunny: Test successful - checks-actions Approved by: epage Pushing cc34b84eadff412559abcaaca0770e32050c3b35 to master...