cargo icon indicating copy to clipboard operation
cargo copied to clipboard

fix: proc-macro example from dep no longer affects feature resolution

Open weihanglo opened this issue 1 year ago • 1 comments

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.

weihanglo avatar May 09 '24 15:05 weihanglo

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

rustbot avatar May 09 '24 15:05 rustbot

@bors r+

epage avatar Jun 10 '24 16:06 epage

:pushpin: Commit 0ead10eebf3a92a9734050da2eb3c3aed07f93e3 has been approved by epage

It is now in the queue for this repository.

bors avatar Jun 10 '24 16:06 bors

:hourglass: Testing commit 0ead10eebf3a92a9734050da2eb3c3aed07f93e3 with merge cc34b84eadff412559abcaaca0770e32050c3b35...

bors avatar Jun 10 '24 16:06 bors

:sunny: Test successful - checks-actions Approved by: epage Pushing cc34b84eadff412559abcaaca0770e32050c3b35 to master...

bors avatar Jun 10 '24 17:06 bors