Skip to content

Avoid double binding of subdiagnostics inside #[derive(SessionDiagnostic)] - #97121

Merged
bors merged 6 commits into
rust-lang:masterfrom
pvdrz:do-subdiagnostics-later
May 24, 2022
Merged

Avoid double binding of subdiagnostics inside #[derive(SessionDiagnostic)]#97121
bors merged 6 commits into
rust-lang:masterfrom
pvdrz:do-subdiagnostics-later

Conversation

@pvdrz

Copy link
Copy Markdown
Contributor

@rustbotrustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label May 17, 2022
@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 17, 2022
Comment threadcompiler/rustc_macros/src/diagnostics/diagnostic.rs
@pvdrzpvdrz changed the title Generate code for subdiagnostic fields in the second match inside #[derive(SessionDiagnostic)]Avoid double binding of subdiagnostics inside #[derive(SessionDiagnostic)]May 18, 2022
@pvdrz
pvdrz requested a review from davidtwcoMay 18, 2022 15:51
pvdrz added 3 commits May 18, 2022 10:53
this simplifies the code inside the `structure.each` closure argument
and allows to remove the `vis` field from `FieldInfo`.
@rust-log-analyzer

This comment has been minimized.

};

// Keep track of which fields are subdiagnostics or have no attributes.
let mut subdiagnostics_or_empty = std::collections::HashSet::new();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm torn on whether or not we should build up a set like this or just do the same check again but negate the result (putting it into a function to avoid duplication obviously). Any thoughts?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I'm under the impression that having the set should be faster than doing the check again but I don't have any hard evidence on it either. I'm happy with both alternatives anyway.

I checked synstructure to see if we could generate both at the same time to avoid the second filter but it seems that's not the case.

@pvdrz
pvdrz requested a review from davidtwcoMay 23, 2022 20:56
@davidtwco

Copy link
Copy Markdown
Member

@bors r+

@bors

bors commented May 24, 2022

Copy link
Copy Markdown
Collaborator

📌 Commit 8227e69 has been approved by davidtwco

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 24, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request May 24, 2022
…vidtwco
Avoid double binding of subdiagnostics inside `#[derive(SessionDiagnostic)]`
r? `@davidtwco`
@Dylan-DPCDylan-DPC mentioned this pull request May 24, 2022
@bors

bors commented May 24, 2022

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 8227e69 with merge b2eba05...

@bors

bors commented May 24, 2022

Copy link
Copy Markdown
Collaborator

☀️ Test successful - checks-actions
Approved by: davidtwco
Pushing b2eba05 to master...

@borsbors added the merged-by-bors This PR was explicitly merged by bors. label May 24, 2022
@bors
bors merged commit b2eba05 into rust-lang:masterMay 24, 2022
@rustbotrustbot added this to the 1.63.0 milestone May 24, 2022
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (b2eba05): comparison url.

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results
  • Primary benchmarks: 🎉 relevant improvement found
  • Secondary benchmarks: mixed results
Regressions 😿
(primary)
Regressions 😿
(secondary)
Improvements 🎉
(primary)
Improvements 🎉
(secondary)
All 😿 🎉
(primary)
count101121
mean2N/A2.7%-3.4%-2.2%-3.4%
maxN/A2.7%-3.4%-3.5%-3.4%

Cycles

Results
  • Primary benchmarks: 😿 relevant regression found
  • Secondary benchmarks: 🎉 relevant improvement found
Regressions 😿
(primary)
Regressions 😿
(secondary)
Improvements 🎉
(primary)
Improvements 🎉
(secondary)
All 😿 🎉
(primary)
count110011
mean22.1%N/AN/A-2.5%2.1%
max2.1%N/AN/A-2.5%2.1%

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

Footnotes

  1. number of relevant changes2

  2. the arithmetic mean of the percent change2

@compiler-errorscompiler-errors added the A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic label Aug 11, 2022
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-translationArea: Translation infrastructure, and migrating existing diagnostics to SessionDiagnosticmerged-by-borsThis PR was explicitly merged by bors.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@pvdrz@rust-log-analyzer@davidtwco@bors@rust-timer@compiler-errors@rust-highfive@rustbot