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

Tracking Issue for rustc's translatable diagnostics infrastructure #132181

Open
2 tasks done
jieyouxu opened this issue Oct 26, 2024 · 0 comments
Open
2 tasks done

Tracking Issue for rustc's translatable diagnostics infrastructure #132181

jieyouxu opened this issue Oct 26, 2024 · 0 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. D-diagnostic-infra Diagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself. E-hard Call for participation: Hard difficulty. Experience needed to fix: A lot. E-needs-design This issue needs exploration and design to see how and if we can fix/implement it T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-diagnostics Working group: Diagnostics

Comments

@jieyouxu
Copy link
Member

jieyouxu commented Oct 26, 2024

This is a tracking issue for rustc's translatable diagnostics infrastructure, which is related to #100717 but reflects the current status.

Current status

Unfortunately, we have found that the current implementation of diagnostic translation infrastructure causes non-insignificant friction for compiler contributors when trying to work on diagnostics, including but not limited to:

  • Having to edit multiple files (fluent file, errors.rs and the emission site, etc.)
  • The diagnostics derive DSL is quite complex and exhibits some quirks
  • Fluent DSL also has its own quirks
  • Sometimes not sufficiently flexible to accommodate diagnostic needs, e.g. see rustc_const_eval or other not-migrated examples.

Important

Based on these friction points, we want to downgrade the internal lints untranslatable_diagnostic/diagnostic_outside_of_impl requiring usage of current translatable diagnostic infra from deny to allow.

If someone wants to continue the translatable diagnostics effort, then they will need to come up with a better redesign that causes less friction for compiler contributors.

Related discussions

Implementation steps

Relaxing the current restrictions

Come up with a redesign

Note: this is not currently being actively worked on AFAICT, please speak with wg-diagnostics and T-compiler if you wish to pursue this. See specifically https://rust-lang.zulipchat.com/#narrow/channel/336883-i18n/topic/.23100717.20diag.20translation/near/472701978.

  • A redesign of the translatable diagnostics infra will need to address the needs of both compiler contributors and translation teams. In particular, it cannot cause significant burden or friction for compiler contributors.

Further steps are presently unclear.

Unresolved questions

  • What do we do with the current diagnostic translation infrastructure?
  • What about the Pontoon infrastructure?
  • What about translation teams?

Implementation / experimentation history

This listing is moreso focused on diagnostic infra itself, not migration efforts. Please see the closed PRs for what concrete issues they have ran into.

More discussions


cc @rust-lang/wg-diagnostics

@jieyouxu jieyouxu added A-diagnostics Area: Messages for errors, warnings, and lints A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. D-diagnostic-infra Diagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself. E-hard Call for participation: Hard difficulty. Experience needed to fix: A lot. E-needs-design This issue needs exploration and design to see how and if we can fix/implement it T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-diagnostics Working group: Diagnostics labels Oct 26, 2024
jieyouxu added a commit to jieyouxu/rust that referenced this issue Oct 26, 2024
jieyouxu added a commit to jieyouxu/rust that referenced this issue Oct 26, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Oct 26, 2024
… r=compiler-errors

Downgrade `untranslatable_diagnostic` and `diagnostic_outside_of_impl` to `allow`

Current implementation of translatable diagnostics infrastructure unfortunately causes some friction for compiler contributors. While we don't have a redesign that causes less friction in place, let's downgrade the internal `untranslatable_diagnostic` and `diagnostic_outside_of_impl` lints so we don't indicate to contributors that they *have* to use the current translation infra.

I purposefully left `#[allow(untranslatable_diagnostic)]` and `#[allow(diagnostic_outside_of_impl)]` instances untouched because that seems like unnecessary additional churn.

See <rust-lang#132181> for context.

r? `@davidtwco` (or wg-diagnostics/compiler)
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Oct 26, 2024
Rollup merge of rust-lang#132182 - jieyouxu:downgrade-untranslatable, r=compiler-errors

Downgrade `untranslatable_diagnostic` and `diagnostic_outside_of_impl` to `allow`

Current implementation of translatable diagnostics infrastructure unfortunately causes some friction for compiler contributors. While we don't have a redesign that causes less friction in place, let's downgrade the internal `untranslatable_diagnostic` and `diagnostic_outside_of_impl` lints so we don't indicate to contributors that they *have* to use the current translation infra.

I purposefully left `#[allow(untranslatable_diagnostic)]` and `#[allow(diagnostic_outside_of_impl)]` instances untouched because that seems like unnecessary additional churn.

See <rust-lang#132181> for context.

r? `@davidtwco` (or wg-diagnostics/compiler)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. D-diagnostic-infra Diagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself. E-hard Call for participation: Hard difficulty. Experience needed to fix: A lot. E-needs-design This issue needs exploration and design to see how and if we can fix/implement it T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-diagnostics Working group: Diagnostics
Projects
None yet
Development

No branches or pull requests

1 participant