Skip to content
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

Resolve duplicate diag message for: tests/ui/renamed_builtin_attr.rs #12960

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

grtn316
Copy link

@grtn316 grtn316 commented Jun 19, 2024

This PR is to resolve duplicate diag messages for the renamed_builtin_attr UI test which is related to: #12379

This was caused by multiple functions calling the get_attr function resulting in the deprecated attribute to be reevaluated.

I added a state to the attr.rs file to track if the warning has already been emitted and skip the evaluation if the attribute warning has already been emitted.

changelog: [renamed_builtin_attr]: Fix duplicate diagnostics

@rustbot
Copy link
Collaborator

rustbot commented Jun 19, 2024

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Manishearth (or someone else) some time within the next two weeks.

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 Jun 19, 2024
@Alexendoo
Copy link
Member

This one is a bit of an edge case compared to the others since it's not being caused by a single lint. Since the deduplication here is similar to what the diagnostic infrastructure is doing internally it might be worth keeping this one as a duplicate emitter

@Manishearth
Copy link
Member

r? @Alexendoo

@rustbot rustbot assigned Alexendoo and unassigned Manishearth Jun 20, 2024
@grtn316
Copy link
Author

grtn316 commented Jun 20, 2024

This one is a bit of an edge case compared to the others since it's not being caused by a single lint. Since the deduplication here is similar to what the diagnostic infrastructure is doing internally it might be worth keeping this one as a duplicate emitter

Hi @Alexendoo. The only thing worth mentioning is that currently, without this fix, each deprecated attribute will be evaluated 4x which means 4 messages per attribute will be emitted. With this fix it will only be emitted once. More of a cosmetic thing but wanted to mention just in case.

@bors
Copy link
Contributor

bors commented Jun 27, 2024

☔ The latest upstream changes (presumably #12999) made this pull request unmergeable. Please resolve the merge conflicts.

@Alexendoo
Copy link
Member

UI wise duplicates are hidden by default, we set -Zdeduplicate-diagnostics=no to show duplicates as it may indicate an issue. You're right though that it's still being evaluated repeatedly which is wasteful, we could move the check into e.g.

fn check_attribute(&mut self, cx: &LateContext<'tcx>, attr: &'tcx Attribute) {

so it's only happening once per attribute

@Alexendoo
Copy link
Member

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants