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

Make Emitter::emit_diagnostic consuming. #120575

Merged
merged 1 commit into from
Feb 6, 2024

Conversation

nnethercote
Copy link
Contributor

Some nice improvements. Details in the individual commit logs.

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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Feb 2, 2024
@rustbot
Copy link
Collaborator

rustbot commented Feb 2, 2024

Some changes occurred in src/tools/rustfmt

cc @rust-lang/rustfmt

@estebank
Copy link
Contributor

estebank commented Feb 2, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Feb 2, 2024

📌 Commit 8e9eb16 has been approved by estebank

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Feb 2, 2024

🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened.

@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 2, 2024
@nnethercote
Copy link
Contributor Author

I removed the unintentional njn comment.

@bors r=estebank

@bors
Copy link
Contributor

bors commented Feb 2, 2024

📌 Commit 226b3f3 has been approved by estebank

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Feb 2, 2024

🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 3, 2024
…handling, r=estebank

Simplify codegen diagnostic handling

Some nice improvements. Details in the individual commit logs.

r? `@estebank`
@bors
Copy link
Contributor

bors commented Feb 4, 2024

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

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 4, 2024
@nnethercote
Copy link
Contributor Author

I fixed the conflicts.

@bors r=estebank

@bors
Copy link
Contributor

bors commented Feb 5, 2024

📌 Commit f4dce1e 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 5, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 5, 2024
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#120507 (Account for non-overlapping unmet trait bounds in suggestion)
 - rust-lang#120518 (riscv only supports split_debuginfo=off for now)
 - rust-lang#120521 (Make `NonZero` constructors generic.)
 - rust-lang#120527 (Switch OwnedStore handle count to AtomicU32)
 - rust-lang#120550 (Continue to borrowck even if there were previous errors)
 - rust-lang#120587 (miri: normalize struct tail in ABI compat check)
 - rust-lang#120590 (Remove unused args from functions)
 - rust-lang#120607 (fix rust-lang#120603 by adding a check in default_read_buf)

Failed merges:

 - rust-lang#120575 (Simplify codegen diagnostic handling)

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 5, 2024
…handling, r=estebank

Simplify codegen diagnostic handling

Some nice improvements. Details in the individual commit logs.

r? `@estebank`
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 5, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#120396 (Account for unbounded type param receiver in suggestions)
 - rust-lang#120423 (update indirect structural match lints to match RFC and to show up for dependencies)
 - rust-lang#120435 (Suggest name value cfg when only value is used for check-cfg)
 - rust-lang#120507 (Account for non-overlapping unmet trait bounds in suggestion)
 - rust-lang#120520 (Some cleanups around diagnostic levels.)
 - rust-lang#120521 (Make `NonZero` constructors generic.)
 - rust-lang#120527 (Switch OwnedStore handle count to AtomicU32)
 - rust-lang#120550 (Continue to borrowck even if there were previous errors)
 - rust-lang#120575 (Simplify codegen diagnostic handling)

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 5, 2024
…handling, r=estebank

Simplify codegen diagnostic handling

Some nice improvements. Details in the individual commit logs.

r? ``@estebank``
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 5, 2024
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#120396 (Account for unbounded type param receiver in suggestions)
 - rust-lang#120423 (update indirect structural match lints to match RFC and to show up for dependencies)
 - rust-lang#120435 (Suggest name value cfg when only value is used for check-cfg)
 - rust-lang#120507 (Account for non-overlapping unmet trait bounds in suggestion)
 - rust-lang#120521 (Make `NonZero` constructors generic.)
 - rust-lang#120527 (Switch OwnedStore handle count to AtomicU32)
 - rust-lang#120550 (Continue to borrowck even if there were previous errors)
 - rust-lang#120575 (Simplify codegen diagnostic handling)

r? `@ghost`
`@rustbot` modify labels: rollup
@matthiaskrgr
Copy link
Member

@bors r-
failed in #120665 (comment) I think

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 5, 2024
All the other `emit`/`emit_diagnostic` methods were recently made
consuming (e.g. rust-lang#119606), but this one wasn't. But it makes sense to.

Much of this is straightforward, and lots of `clone` calls are avoided.
There are a couple of tricky bits.
- `Emitter::primary_span_formatted` no longer takes a `Diagnostic` and
  returns a pair. Instead it takes the two fields from `Diagnostic` that
  it used (`span` and `suggestions`) as `&mut`, and modifies them. This
  is necessary to avoid the cloning of `diag.children` in two emitters.
- `from_errors_diagnostic` is rearranged so various uses of `diag` occur
  before the consuming `emit_diagnostic` call.
@nnethercote
Copy link
Contributor Author

Maybe in the past rustc_errors::Diagnostic wasn't Send? But it works now.

Alas, it works in parallel compiler builds, but not in serial compiler builds. So the first two commits I had here aren't valid. I've updated to just have the third commit.

@bors r=estebank rollup

@bors
Copy link
Contributor

bors commented Feb 5, 2024

📌 Commit d9508a1 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 5, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 5, 2024
…handling, r=estebank

Simplify codegen diagnostic handling

Some nice improvements. Details in the individual commit logs.

r? `@estebank`
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 5, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#120023 (tidy: reduce allocs)
 - rust-lang#120396 (Account for unbounded type param receiver in suggestions)
 - rust-lang#120435 (Suggest name value cfg when only value is used for check-cfg)
 - rust-lang#120507 (Account for non-overlapping unmet trait bounds in suggestion)
 - rust-lang#120520 (Some cleanups around diagnostic levels.)
 - rust-lang#120575 (Simplify codegen diagnostic handling)
 - rust-lang#120670 (cleanup effect var handling)

Failed merges:

 - rust-lang#120423 (update indirect structural match lints to match RFC and to show up for dependencies)

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 6, 2024
…handling, r=estebank

Simplify codegen diagnostic handling

Some nice improvements. Details in the individual commit logs.

r? ``@estebank``
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 6, 2024
…handling, r=estebank

Simplify codegen diagnostic handling

Some nice improvements. Details in the individual commit logs.

r? ```@estebank```
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 6, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#120302 (various const interning cleanups)
 - rust-lang#120520 (Some cleanups around diagnostic levels.)
 - rust-lang#120521 (Make `NonZero` constructors generic.)
 - rust-lang#120527 (Switch OwnedStore handle count to AtomicU32)
 - rust-lang#120564 (coverage: Split out counter increment sites from BCB node/edge counters)
 - rust-lang#120575 (Simplify codegen diagnostic handling)
 - rust-lang#120597 (Suggest `[tail @ ..]` on `[..tail]` and `[...tail]` where `tail` is unresolved)
 - rust-lang#120609 (hir: Stop keeping prefixes for most of `use` list stems)
 - rust-lang#120633 (pattern_analysis: gather up place-relevant info)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 6, 2024
…iaskrgr

Rollup of 12 pull requests

Successful merges:

 - rust-lang#120520 (Some cleanups around diagnostic levels.)
 - rust-lang#120575 (Simplify codegen diagnostic handling)
 - rust-lang#120597 (Suggest `[tail @ ..]` on `[..tail]` and `[...tail]` where `tail` is unresolved)
 - rust-lang#120602 (rustc_monomorphize: fix outdated comment in partition)
 - rust-lang#120609 (hir: Stop keeping prefixes for most of `use` list stems)
 - rust-lang#120631 (Emit a diagnostic for invalid target options)
 - rust-lang#120632 (For E0223, suggest associated functions that are similar to the path)
 - rust-lang#120670 (cleanup effect var handling)
 - rust-lang#120673 (rustc_metadata: fix typo)
 - rust-lang#120683 (miri: fix ICE with symbolic alignment check on extern static)
 - rust-lang#120690 (Remove b-naber from the compiler review rotation)
 - rust-lang#120713 (Make async closures test use async bound modifier)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit a3d3ccf into rust-lang:master Feb 6, 2024
11 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Feb 6, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 6, 2024
Rollup merge of rust-lang#120575 - nnethercote:simplify-codegen-diag-handling, r=estebank

Simplify codegen diagnostic handling

Some nice improvements. Details in the individual commit logs.

r? ````@estebank````
@nnethercote nnethercote deleted the simplify-codegen-diag-handling branch February 6, 2024 22:17
@nnethercote nnethercote changed the title Simplify codegen diagnostic handling Make Emitter::emit_diagnostic consuming. Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. T-rustdoc Relevant to the rustdoc 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