Skip to content

Ignore shadow warns in code from macro expansions #10697

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
merged 1 commit into from
Apr 24, 2023

Conversation

lochetti
Copy link
Contributor

@lochetti lochetti commented Apr 22, 2023

This PR fixes #9757

I am in doubt if just looking for pat.span.from_expansion() would be sufficient instead of looking for both pat.span.desugaring_kind().is_some() or pat.span.from_expansion(). The tests (including the new one) passes if I leave only if pat.span.from_expansion(). Any feedbacks?

Also, this is my first PR here, sorry for anything and thanks for the patience!

changelog: [shadow_same, shadow_reuse, shadow_unrelated]: avoiding warns in macro-generated code

@rustbot
Copy link
Collaborator

rustbot commented Apr 22, 2023

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @dswij (or someone else) soon.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Apr 22, 2023
Copy link
Member

@dswij dswij left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

For checking if the span is from macros, from_expansion() works just fine. I'd guess that the idea behind ignoring any spans from desugar (through desugaring_kind().is_some()) is just to be safe - i.e., shadows in desugared code should not be linted.

I'd say that it makes sense and it's fine to leave the desugar check as it is for now.

@dswij
Copy link
Member

dswij commented Apr 24, 2023

@bors r+

@bors
Copy link
Contributor

bors commented Apr 24, 2023

📌 Commit 628605e has been approved by dswij

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Apr 24, 2023

⌛ Testing commit 628605e with merge 5161c4c...

@bors
Copy link
Contributor

bors commented Apr 24, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: dswij
Pushing 5161c4c to master...

1 similar comment
@bors
Copy link
Contributor

bors commented Apr 24, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: dswij
Pushing 5161c4c to master...

@bors bors merged commit 5161c4c into rust-lang:master Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Possible problems involving clippy::shadow_reuse and auto-generated code
4 participants