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

macros: diagnostic derive on enums #102189

Merged
merged 1 commit into from
Sep 27, 2022

Conversation

davidtwco
Copy link
Member

@davidtwco davidtwco commented Sep 23, 2022

Part of #100717.

Extends #[derive(Diagnostic)] to work on enums too where each variant acts like a distinct diagnostic - being able to represent diagnostics this way can be quite a bit simpler for some parts of the compiler.

r? @compiler-errors
cc @Xiretza

@rustbot rustbot added A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 23, 2022
@rustbot
Copy link
Collaborator

rustbot commented Sep 23, 2022

rustc_macros::diagnostics was changed

cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 23, 2022
}

#[derive(Diagnostic)]
enum ExampleEnum {
Copy link
Member Author

Choose a reason for hiding this comment

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

I only added this test for the enums, in addition to the existing case that needed changed and is a failing test - most of the logic is the same so I don't think it is super necessary to test everything again with enums but I can if we want.

@davidtwco davidtwco mentioned this pull request Sep 26, 2022
84 tasks
Signed-off-by: David Wood <david.wood@huawei.com>
Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

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

Looks great!

@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Sep 27, 2022

📌 Commit f20c882 has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors 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 Sep 27, 2022
@bors
Copy link
Contributor

bors commented Sep 27, 2022

⌛ Testing commit f20c882 with merge de0b511...

@bors
Copy link
Contributor

bors commented Sep 27, 2022

☀️ Test successful - checks-actions
Approved by: compiler-errors
Pushing de0b511 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 27, 2022
@bors bors merged commit de0b511 into rust-lang:master Sep 27, 2022
@rustbot rustbot added this to the 1.66.0 milestone Sep 27, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (de0b511): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

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

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.4% [2.1%, 2.8%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.2% [-2.2%, -2.2%] 1
All ❌✅ (primary) - - 0

Cycles

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

Footnotes

  1. the arithmetic mean of the percent change

  2. number of relevant changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant 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