Skip to content

Refactor Translator #142650

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 3 commits into from
Jun 21, 2025
Merged

Refactor Translator #142650

merged 3 commits into from
Jun 21, 2025

Conversation

camsteffen
Copy link
Contributor

@camsteffen camsteffen commented Jun 17, 2025

My main motivation was to simplify the usage of SilentEmitter for users like rustfmt. A few refactoring opportunities arose along the way.

  • Replace Translate trait with Translator struct
  • Replace Emitter: Translate with Emitter::translator
  • Split SilentEmitter into FatalOnlyEmitter and SilentEmitter

@rustbot
Copy link
Collaborator

rustbot commented Jun 17, 2025

r? @petrochenkov

rustbot has assigned @petrochenkov.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic 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 Jun 17, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jun 17, 2025

Some changes occurred in compiler/rustc_codegen_ssa

cc @WaffleLapkin

rustc_errors::translation was changed

cc @davidtwco, @compiler-errors, @TaKO8Ki

rustc_error_messages was changed

cc @davidtwco, @compiler-errors, @TaKO8Ki

Some changes occurred in src/tools/rustfmt

cc @rust-lang/rustfmt

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@petrochenkov
Copy link
Contributor

Looks reasonable to me.
@bors r+

@bors
Copy link
Collaborator

bors commented Jun 18, 2025

📌 Commit 4a86853 has been approved by petrochenkov

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 Jun 18, 2025
@bjorn3
Copy link
Member

bjorn3 commented Jun 19, 2025

(bors forgot to post a comment about the merge conflicts)

@petrochenkov
Copy link
Contributor

@bors r-
@rustbot author

@rustbot
Copy link
Collaborator

rustbot commented Jun 19, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 19, 2025
@bors bors removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jun 19, 2025
@camsteffen camsteffen force-pushed the refactor-translator branch from 4a86853 to 3388d83 Compare June 19, 2025 18:07
@camsteffen
Copy link
Contributor Author

camsteffen commented Jun 19, 2025

Rebased and renamed to FatalOnlyEmitter. @rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 19, 2025
@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 19, 2025

📌 Commit 3388d83 has been approved by petrochenkov

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 Jun 19, 2025
bors added a commit that referenced this pull request Jun 20, 2025
Rollup of 9 pull requests

Successful merges:

 - #142331 (Add `trim_prefix` and `trim_suffix` methods for both `slice` and `str` types.)
 - #142491 (Rework #[cold] attribute parser)
 - #142494 (Fix missing docs in `rustc_attr_parsing`)
 - #142495 (Better template for `#[repr]` attributes)
 - #142497 (Fix random failure when JS code is executed when the whole file was not read yet)
 - #142575 (Ensure copy* intrinsics also perform the static self-init checks)
 - #142650 (Refactor Translator)
 - #142713 (mbe: Refactor transcription)
 - #142755 (rustdoc: Remove `FormatRenderer::cache`)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Jun 20, 2025
Rollup of 9 pull requests

Successful merges:

 - #142331 (Add `trim_prefix` and `trim_suffix` methods for both `slice` and `str` types.)
 - #142491 (Rework #[cold] attribute parser)
 - #142494 (Fix missing docs in `rustc_attr_parsing`)
 - #142495 (Better template for `#[repr]` attributes)
 - #142497 (Fix random failure when JS code is executed when the whole file was not read yet)
 - #142575 (Ensure copy* intrinsics also perform the static self-init checks)
 - #142650 (Refactor Translator)
 - #142713 (mbe: Refactor transcription)
 - #142755 (rustdoc: Remove `FormatRenderer::cache`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 38600a6 into rust-lang:master Jun 21, 2025
10 checks passed
@rustbot rustbot added this to the 1.89.0 milestone Jun 21, 2025
rust-timer added a commit that referenced this pull request Jun 21, 2025
Rollup merge of #142650 - camsteffen:refactor-translator, r=petrochenkov

Refactor Translator

My main motivation was to simplify the usage of `SilentEmitter` for users like rustfmt. A few refactoring opportunities arose along the way.

* Replace `Translate` trait with `Translator` struct
* Replace `Emitter: Translate` with `Emitter::translator`
* Split `SilentEmitter` into `FatalOnlyEmitter` and `SilentEmitter`
@camsteffen camsteffen deleted the refactor-translator branch June 21, 2025 11:05
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic 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