-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Diagnostic Translation #100717
Comments
I took up |
I'm migrating |
I'll probably look into migrating |
I'm working on |
I'm doing the zero diagnostic crates in one PR, will constantly edit this comment to keep track of which ones they were.
Easy ones to do (please leave a comment if you claim them!)
|
I'm working on |
Working on:
|
@5225225 I'll continue to look for something unclaimed and small... |
🤷🏻♂️ I can't find this one. Should I be on a branch other than |
Update your checkout. It's on |
🤦🏻♂️ Thanks! I was working off a clone of my fork. I'm glad I discovered this now. |
Also if you want something small, rustc_monomorphize has 16 errors. |
Working on |
Working on |
Working on |
Update: The documentatation I was looking at was inaccurate. You need to do |
Working on |
Working on |
working on |
🙇 kinda burned out, hoping someone could take it. |
Working on Currently,
|
Working on |
It's so exciting to wake up to all this interest and progress, I've updated the list with what everyone is working on. |
I would like to work on |
A bonus task for someone who is interested, @compiler-errors makes the good suggestion that we could replace
Update: @Xiretza is handling this one, see next few comments and Zulip discussion. |
…ics, r=davidtwco Migrate rustc_codegen_gcc to SessionDiagnostics As part of rust-lang#100717 this pr migrates diagnostics to `SessionDiagnostics` for the `rustc_codegen_gcc` crate. ``@rustbot`` label +A-translation
…r=davidtwco Migrate some rustc_builtin_macros to SessionDiagnostic Part of rust-lang#100717. `@rustbot` label +A-translation
…r=davidtwco Migrate some rustc_builtin_macros to SessionDiagnostic Part of rust-lang#100717. ``@rustbot`` label +A-translation
…r=davidtwco Migrate some rustc_builtin_macros to SessionDiagnostic Part of rust-lang#100717. ```@rustbot``` label +A-translation
I'm going to work on |
I'm picking up the apparently abandoned |
I'm taking |
…, r=davidtwco Migrate some rustc_builtin_macros to SessionDiagnostic <!-- If this PR is related to an unstable feature or an otherwise tracked effort, please link to the relevant tracking issue here. If you don't know of a related tracking issue or there are none, feel free to ignore this. This PR will get automatically assigned to a reviewer. In case you would like a specific user to review your work, you can assign it to them by using r? <reviewer name> --> Part of rust-lang#100717. pick up abandoned pr: rust-lang#101935 `@rustbot` label +A-translation
Rollup merge of rust-lang#126405 - He1pa:translate_builtin_macro_diag, r=davidtwco Migrate some rustc_builtin_macros to SessionDiagnostic <!-- If this PR is related to an unstable feature or an otherwise tracked effort, please link to the relevant tracking issue here. If you don't know of a related tracking issue or there are none, feel free to ignore this. This PR will get automatically assigned to a reviewer. In case you would like a specific user to review your work, you can assign it to them by using r? <reviewer name> --> Part of rust-lang#100717. pick up abandoned pr: rust-lang#101935 `@rustbot` label +A-translation
…stic, r=nnethercote Get rid of some `#[allow(rustc::untranslatable_diagnostic)]` `@rustbot` label +A-translation cc rust-lang#100717
…stic, r=nnethercote Get rid of some `#[allow(rustc::untranslatable_diagnostic)]` ``@rustbot`` label +A-translation cc rust-lang#100717
…stic, r=nnethercote Get rid of some `#[allow(rustc::untranslatable_diagnostic)]` ```@rustbot``` label +A-translation cc rust-lang#100717
…stic, r=nnethercote Get rid of some `#[allow(rustc::untranslatable_diagnostic)]` `@rustbot` label +A-translation cc rust-lang#100717
Rollup merge of rust-lang#128886 - GrigorenkoPV:untranslatable-diagnostic, r=nnethercote Get rid of some `#[allow(rustc::untranslatable_diagnostic)]` `@rustbot` label +A-translation cc rust-lang#100717
Important Please see #132181 for the current status of the compiler's translatable diagnostics infrastructure. |
Important
Please see #132181 for the current status of the compiler's translatable diagnostics infrastructure.
The Rust Diagnostics working group is leading an effort to add support for internationalization of error messages in the compiler, allowing the compiler to produce output in languages other than English. This issue tracks the current status of the effort, which was announced in the "Contribute to the diagnostic translation effort!" post on Inside Rust.
What's the current status?
Diagnostic translation will take a long time to be finished. At a high-level, there are four primary steps:
Implementing the initial translation infrastructure provides the groundwork that enables diagnostic messages to be made translatable at all. That initial infrastructure is largely completed - there might be some gaps that we'll discover and patch up as we continue - but it's almost all there.
Next, all of the diagnostics in rustc need to be modified so that they can be translatable. There's some bad news - that's a lot of work. But there's also some good news - that's a lot of highly parallelizable work that you can help with! It doesn't require any familiarity with the Rust compiler, just an eagerness to get involved.
How to get started?
It's very easy to get started, the process looks like the following:
Identifying diagnostics to migrate
Our goal is to migrate every diagnostic in the compiler to be translatable and to switch from using a "diagnostic builder" to using "diagnostic structs". That's a lot of diagnostics, so we're splitting the work up by module in the compiler so that nobody steps on anyone else's toes.
rustc_apfloat
rustc_arena
rustc_ast
rustc_ast_lowering
rustc_ast_passes
SessionDiagnostic
and translatable messages (first part) #100694ast_passes
to derive diagnostics #108456rustc_ast_pretty
rustc_attr
rustc_attr
crate diagnostics #100836rustc_borrowck
rustc_borrowck
diagnostic #100798rustc_borrowck
diagnostics toSessionDiagnostic
#100864region_errors.rs
#100900mutability_errors.rs
diag-mig #101301Borrowck
: diag migrate #101276descr
#103469borrowck
diagnostic migration #101686rustc_borrowck
#104055rustc_builtin_macros
rustc_builtin_macros
toSessionDiagnostic
#101408rustc_builtin_macros
to diagnostic impls #110092rustc_codegen_cranelift
rustc_codegen_gcc
rustc_codegen_llvm
rustc_codegen_ssa
codegen_ssa
to diagnostics structs - [Part 1] #102612codegen_ssa
to diagnostics structs - [Part 2] #103792rustc_const_eval
rustc_data_structures
rustc_driver
rustc_error_codes
rustc_error_messages
rustc_errors
IntoDiagnostic
conformance forTargetDataLayoutErrors
intorustc_errors
#102684rustc_expand
rustc_feature
rustc_fs_util
rustc_graphviz
rustc_hir
rustc_hir_analysis
rustc_hir_analysis
to session diagnostic [Part One] #108434rustc_hir_pretty
rustc_hir_typeck
rustc_incremental
rustc_index
rustc_infer
rustc_interface
rustc_interface
diagnostics #100808rustc_lexer
rustc_lint
rustc_lint
errors toSessionDiagnostic
#100776rustc_lint
lint diagnostics #101138rustc_lint_defs
rustc_llvm
rustc_log
rustc_macros
rustc_metadata
rustc_middle
rustc_middle
diagnostic #101021rustc_mir_build
rustc_mir_build
diagnostics #100854 (continue from this partially completed work!)rustc_mir_dataflow
rustc_monomorphize
rustc_parse
rustc_parse_format
rustc_passes
rustc_passes
diagnostics #100870dead_code
lints to be translatable. #103397rustc_plugin_impl
rustc_plugin_impl
toSessionDiagnostic
#100768rustc_privacy
rustc_query_impl
rustc_query_system
rustc_resolve
rustc_resolve
to session diagnostic #123896rustc_save_analysis
rustc_serialize
rustc_session
rustc_session
to useSessionDiagnostic
- Pt. 1 #100753 101466rustc_smir
rustc_span
rustc_symbol_mangling
symbol_mangling
module to new diagnostics structs #100831rustc_target
rustc_trait_selection::traits::error_reporting::suggestions
rustc_trait_selection::traits::error_reporting::suggestions
toSessionDiagnostic
#101466rustc_trait_selection
(everything else)rustc_traits
rustc_transmute
rustc_transmute
module (zero diags) #100842rustc_ty_utils
rustc_ty_utils
toSessionDiagnostic
#100735SessionDiagnostic
#110095rustc_type_ir
rustc_type_ir
module #100721rustfmt
clippy
rustdoc
Note: Some of these crates might not have diagnostics in them, in which case we'll just enable our internal lints on them. Some might have lots and lots of work that we can split up further, let us know! If there aren't many crates left, then feel free to leave a comment asking if someone is still working on their crate (check if they commented or have put a PR up recently).
Once you've picked a module (leave a comment letting us know!), how do you find the diagnostics to migrate? We've created rustc-internal lints that you can apply to a module which will produce an error for every diagnostic that hasn't been migrated.
(an example of using these would just be adding them to the top of a file)
After adding these attributes, you can run
./x.py check
to build the compiler in check mode (just likecargo check
in another project). You'll notice a bunch of errors that will look something like these:There will be two errors for each diagnostic that isn't migrated:
err.label("an example label")
instead oferr.label(fluent::example_label)
fluent::example_label
corresponds to a message in a "Fluent resource" which we can provide different versions of for each language.Diagnostic
/Subdiagnostic
impls"Diagnostic
orSubdiagnostic
. One of our goals with this migration is to move all diagnostic emission logic into impls on structs, as it helps keep the compiler tidy and works towards other goals of the diagnostics working group.Diagnostic
for errors and warnings,LintDiagnostic
for lints, orSubdiagnsostic
for parts of an error/warning/lint) manually.We'll know we're finished when we can leave those attributes on every module in the compiler.
Migrate diagnostics
Okay, so you've got a diagnostic in front of you that you need to migrate.. now what?
A-translation
.While migrating diagnostics, there might be cases you run into that we've not run across yet. Let us know in Zulip, you might be able to experiment and teach us how to translate some diagnostics, or there may be an opportunity to extend our core infrastructure (e.g. the derives). Don't worry though, you can always skip a diagnostic and leave it for someone else too.
Where to get help?
Discussion is primarily happening in the
#i18n
stream on Zulip. Ask any questions you have in that chat and someone will try to help. If you don't get a response, feel free to ping@davidtwco
or@t-compiler/wg-diagnostics
.One-off tasks
Sometimes there are one-off tasks which improve compiler infrastructure around translation or just make things easier to use, these are listed below, feel free to comment to take them:
Completed
Extendmacros: diagnostic derive on enums #102189SessionDiagnostic
derive to work on enums (context)In #100753, there are some functions annotated withlint: avoid linting diag functions with diag lints #101230#[rustc_lint_diagnostics]
which is used to know when to trigger our internal lints, that are themselves triggering the internal lint - it would be good to change the internal lint so that it skips functions annotated with#[rustc_lint_diagnostics]
.SupportDiagnostic derives: allow specifying multiple alternative suggestions #103209span_suggestions
-equivalent in diagnostic derives.errors: generate typed identifiers in each crate #103042Diagnosticsicu4x
based list formatting. #104047In-progress
To-do
DefId
toSpan
conversions in the derive macros, e.g.#[primary_span(def_span)]
or something like that (context).Option<impl IntoDiagnosticArg>
(context)MultiSpan
(context).IntoDiagnosticSpan
trait that can be implemented for anything usable with#[primary_span]
(i.e. so we can extend#[primary_span]
support toIdent
easily, for example) (partially complete at https://github.com/davidtwco/rust/tree/translation-into-diagnostic-span)The text was updated successfully, but these errors were encountered: