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

Improve codegen diagnostic handling #121129

Merged
merged 3 commits into from
Feb 22, 2024
Merged

Conversation

nnethercote
Copy link
Contributor

Clarify the workings of the temporary Diagnostic type used to send diagnostics from codegen threads to the main thread.

r? @estebank

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 15, 2024
@nnethercote
Copy link
Contributor Author

This is a rehash of what I attempted in #120575, before I learned that rustc_errors::Diagnostic doesn't impl Send in all configurations.

@bors
Copy link
Contributor

bors commented Feb 15, 2024

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

@rustbot
Copy link
Collaborator

rustbot commented Feb 15, 2024

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

@nnethercote
Copy link
Contributor Author

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

I fixed the conflicts, and that change actually let me do an additional cleanup involving Diagnostic::args, which is nice.

cc @chenyukang

@bors
Copy link
Contributor

bors commented Feb 20, 2024

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

@nnethercote
Copy link
Contributor Author

I rebased.

@bors
Copy link
Contributor

bors commented Feb 21, 2024

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

First, introduce a typedef `DiagnosticArgMap`.

Second, make the `args` field public, and remove the `args` getter and
`replace_args` setter. These were necessary previously because the getter
had a `#[allow(rustc::potential_query_instability)]` attribute, but that
was removed in rust-lang#120931 when the args were changed from `FxHashMap` to
`FxIndexMap`. (All the other `Diagnostic` fields are public.)
- Make it more closely match `rustc_errors::Diagnostic`, by making the
  field names match, and adding `children`, which requires adding
  `rustc_codegen_ssa::back::write::Subdiagnostic`.
- Check that we aren't missing important info when converting
  diagnostics.
- Add better comments.
- Tweak `rustc_errors::Diagnostic::replace_args` so that we don't need
  to do any cloning when converting diagnostics.
It's always paired wth `SharedEmitterMessage::Diagnostic`, so the two
can be merged.
@nnethercote
Copy link
Contributor Author

Another rebase, woo!

@estebank
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Feb 22, 2024

📌 Commit 6efffd7 has been approved by estebank

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 Feb 22, 2024
@bors
Copy link
Contributor

bors commented Feb 22, 2024

⌛ Testing commit 6efffd7 with merge f70f19f...

@bors
Copy link
Contributor

bors commented Feb 22, 2024

☀️ Test successful - checks-actions
Approved by: estebank
Pushing f70f19f to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 22, 2024
@bors bors merged commit f70f19f into rust-lang:master Feb 22, 2024
12 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Feb 22, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f70f19f): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-5.1% [-5.1%, -5.1%] 1
All ❌✅ (primary) - - 0

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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.3% [-2.3%, -2.3%] 1
Improvements ✅
(secondary)
-3.9% [-3.9%, -3.9%] 1
All ❌✅ (primary) -2.3% [-2.3%, -2.3%] 1

Cycles

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

Binary size

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

Bootstrap: 648.961s -> 649.949s (0.15%)
Artifact size: 310.94 MiB -> 310.94 MiB (-0.00%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

5 participants