- 
                Notifications
    
You must be signed in to change notification settings  - Fork 2.7k
 
fix: proc-macro example from dep no longer affects feature resolution #13892
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
          
     Merged
      
      
    Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    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.
| 
           @bors r+  | 
    
| 
           ☀️ Test successful - checks-actions  | 
    
    
  bors 
      added a commit
        to rust-lang-ci/rust
      that referenced
      this pull request
    
      Jun 12, 2024 
    
    
      
  
    
      
    
  
Update cargo 14 commits in b1feb75d062444e2cee8b3d2aaa95309d65e9ccd..4dcbca118ab7f9ffac4728004c983754bc6a04ff 2024-06-07 20:16:17 +0000 to 2024-06-11 16:27:02 +0000 - Add local registry overlays (rust-lang/cargo#13926) - docs(change): Don't mention non-existent workspace.badges (rust-lang/cargo#14042) - test: migrate binary_name to snapbox (rust-lang/cargo#14041) - Bump to 0.82.0; update changelog (rust-lang/cargo#14040) - tests: Migrate alt_registry to snapbox (rust-lang/cargo#14031) - fix: proc-macro example from dep no longer affects feature resolution (rust-lang/cargo#13892) - chore: Bump cargo-util-schemas to 0.5 (rust-lang/cargo#14038) - chore(deps): update rust crate pulldown-cmark to 0.11.0 (rust-lang/cargo#14037) - fix: remove `__CARGO_GITOXIDE_DISABLE_LIST_FILES` env var (rust-lang/cargo#14036) - chore(deps): update rust crate itertools to 0.13.0 (rust-lang/cargo#13998) - fix(toml): remove `lib.plugin` key support and make it warning (rust-lang/cargo#13902) - chore(deps): update compatible (rust-lang/cargo#13995) - fix: using `--release/debug` and `--profile` together becomes an error (rust-lang/cargo#13971) - fix(toml): Convert warnings that `licence` and `readme` files do not exist into errors (rust-lang/cargo#13921) r? ghost
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      Labels
      
    A-dependency-resolution
  Area: dependency resolution and the resolver 
  
    A-features2
  Area: issues specifically related to the v2 feature resolver 
  
    A-proc-macro
  Area: compiling proc-macros 
  
    S-waiting-on-bors
  Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 
  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.
  
    
  
    
What does this PR try to resolve?
Previously when checking if a dependency is a proc-macro,
the v2 feature resolver for
proc-macro = truefor 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 = truefor[lib]target for a dependency.
Fixes #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 #13726 (comment).
Thanks @torhovland for the minimal test case.