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

errors: simplify referring to fluent attributes #97357

Conversation

davidtwco
Copy link
Member

@davidtwco davidtwco commented May 24, 2022

To render the message of a Fluent attribute, the identifier of the Fluent message must be known. DiagnosticMessage::FluentIdentifier contains both the message's identifier and optionally the identifier of an attribute. Generated constants for each attribute would therefore need to be named uniquely (amongst all error messages) or be able to refer to only the attribute identifier which will be combined with a message identifier later. In this commit, the latter strategy is implemented as part of the Diagnostic type's functions for adding subdiagnostics of various kinds.

r? @oli-obk

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label May 24, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 24, 2022
@davidtwco davidtwco marked this pull request as draft May 24, 2022 14:46
@bors

This comment was marked as resolved.

@davidtwco davidtwco force-pushed the diagnostic-translation-typed-subdiagnostic-simplification branch from 0ee959c to 2ac3740 Compare May 30, 2022 09:36
@davidtwco davidtwco marked this pull request as ready for review May 30, 2022 09:37
@davidtwco davidtwco requested a review from oli-obk May 30, 2022 09:37

match self {
DiagnosticMessage::Str(s) => DiagnosticMessage::Str(s.clone()),
DiagnosticMessage::FluentIdentifier(id, _) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this ever happen where then _ is Some already?

Copy link
Member Author

Choose a reason for hiding this comment

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

It shouldn't as the code is written right now, but it wouldn't be much of a problem if it did. I considered adding a panic or something like that.

Copy link
Contributor

@oli-obk oli-obk left a comment

Choose a reason for hiding this comment

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

just a nit and a question, r=me with those resolved/answered

To render the message of a Fluent attribute, the identifier of the
Fluent message must be known. `DiagnosticMessage::FluentIdentifier`
contains both the message's identifier and optionally the identifier of
an attribute. Generated constants for each attribute would therefore
need to be named uniquely (amongst all error messages) or be able to
refer to only the attribute identifier which will be combined with a
message identifier later. In this commit, the latter strategy is
implemented as part of the `Diagnostic` type's functions for adding
subdiagnostics of various kinds.

Signed-off-by: David Wood <david.wood@huawei.com>
@davidtwco davidtwco force-pushed the diagnostic-translation-typed-subdiagnostic-simplification branch from 2ac3740 to f669b78 Compare May 30, 2022 12:38
@davidtwco
Copy link
Member Author

@bors r=oli-obk

@bors
Copy link
Contributor

bors commented May 30, 2022

📌 Commit f669b78 has been approved by oli-obk

@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 May 30, 2022
compiler-errors added a commit to compiler-errors/rust that referenced this pull request May 30, 2022
…ped-subdiagnostic-simplification, r=oli-obk

errors: simplify referring to fluent attributes

To render the message of a Fluent attribute, the identifier of the Fluent message must be known. `DiagnosticMessage::FluentIdentifier` contains both the message's identifier and optionally the identifier of an attribute. Generated constants for each attribute would therefore need to be named uniquely (amongst all error messages) or be able to refer to only the attribute identifier which will be combined with a message identifier later. In this commit, the latter strategy is implemented as part of the `Diagnostic` type's functions for adding subdiagnostics of various kinds.

r? `@oli-obk`
@bors
Copy link
Contributor

bors commented May 30, 2022

⌛ Testing commit f669b78 with merge 7be9ec2...

@bors
Copy link
Contributor

bors commented May 31, 2022

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing 7be9ec2 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 31, 2022
@bors bors merged commit 7be9ec2 into rust-lang:master May 31, 2022
@rustbot rustbot added this to the 1.63.0 milestone May 31, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (7be9ec2): comparison url.

Instruction count

  • Primary benchmarks: no relevant changes found
  • Secondary benchmarks: mixed results
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
0.4% 0.6% 9
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
-0.4% -0.5% 4
All 😿🎉 (primary) N/A N/A 0

Max RSS (memory usage)

Results
  • Primary benchmarks: 😿 relevant regressions found
  • Secondary benchmarks: mixed results
mean1 max count2
Regressions 😿
(primary)
4.9% 6.5% 2
Regressions 😿
(secondary)
2.5% 2.5% 1
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
-3.7% -6.0% 4
All 😿🎉 (primary) 4.9% 6.5% 2

Cycles

Results
  • Primary benchmarks: 😿 relevant regressions found
  • Secondary benchmarks: 🎉 relevant improvement found
mean1 max count2
Regressions 😿
(primary)
2.9% 3.8% 6
Regressions 😿
(secondary)
N/A N/A 0
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
-2.2% -2.2% 1
All 😿🎉 (primary) 2.9% 3.8% 6

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

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

@rustbot label: +perf-regression

Footnotes

  1. the arithmetic mean of the percent change 2 3

  2. number of relevant changes 2 3

@rustbot rustbot added the perf-regression Performance regression. label May 31, 2022
@davidtwco davidtwco deleted the diagnostic-translation-typed-subdiagnostic-simplification branch May 31, 2022 07:38
@pnkfelix
Copy link
Member

pnkfelix commented Jun 1, 2022

visiting for rustc-perf performance triage.

There were some regressions here, but they are few, minor, and contained solely to secondary benchmarks (specifically projection-caching and wg-grammar). Marking as triaged.

@rustbot label: perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Jun 1, 2022
@davidtwco davidtwco added the A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic label Aug 17, 2022
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. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. 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.

7 participants