Skip to content

lint: add diagnostic translation migration lints - #97948

Merged
bors merged 1 commit into
rust-lang:masterfrom
davidtwco:diagnostic-translation-lints
Jun 14, 2022
Merged

lint: add diagnostic translation migration lints#97948
bors merged 1 commit into
rust-lang:masterfrom
davidtwco:diagnostic-translation-lints

Conversation

@davidtwco

Copy link
Copy Markdown
Member

Introduce allow-by-default lints for checking whether diagnostics are written in
SessionDiagnostic or AddSubdiagnostic impls and whether diagnostics are translatable. These lints can be denied for modules once they are fully migrated to impls and translation.

These lints are intended to be temporary - once all diagnostics have been changed then we can just change the APIs we have and that will enforce these constraints thereafter.

r? @oli-obk

Introduce allow-by-default lints for checking whether diagnostics are
written in `SessionDiagnostic`/`AddSubdiagnostic` impls and whether
diagnostics are translatable. These lints can be denied for modules once
they are fully migrated to impls and translation.
Signed-off-by: David Wood <david.wood@huawei.com>
@rustbotrustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 10, 2022
@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 10, 2022
debug!(?found_diagnostic_message);
if !found_diagnostic_message {
cx.struct_span_lint(UNTRANSLATABLE_DIAGNOSTIC, span, |lint| {
lint.build("diagnostics should be created using translatable messages").emit();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include some more info, even if it's just a link to the soon-to-be-merged dev guide entry

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lints are intended to be temporary - once all diagnostics have been changed then we can just change the APIs we have and that will enforce these constraints thereafter.

hmm... so basically no one will see them unless they are already in a module heavily making use of it?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, they're really just to prevent us from regressing as we migrate to impls/translation module-by-module

@oli-obk

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Jun 13, 2022

Copy link
Copy Markdown
Collaborator

📌 Commit 5ba81fa has been approved by oli-obk

@borsbors 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 13, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Jun 13, 2022
…nts, r=oli-obk
lint: add diagnostic translation migration lints
Introduce allow-by-default lints for checking whether diagnostics are written in
`SessionDiagnostic` or `AddSubdiagnostic` impls and whether diagnostics are translatable. These lints can be denied for modules once they are fully migrated to impls and translation.
These lints are intended to be temporary - once all diagnostics have been changed then we can just change the APIs we have and that will enforce these constraints thereafter.
r? `@oli-obk`
@Dylan-DPCDylan-DPC mentioned this pull request Jun 13, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Jun 13, 2022
…nts, r=oli-obk
lint: add diagnostic translation migration lints
Introduce allow-by-default lints for checking whether diagnostics are written in
`SessionDiagnostic` or `AddSubdiagnostic` impls and whether diagnostics are translatable. These lints can be denied for modules once they are fully migrated to impls and translation.
These lints are intended to be temporary - once all diagnostics have been changed then we can just change the APIs we have and that will enforce these constraints thereafter.
r? ``@oli-obk``
@Dylan-DPCDylan-DPC mentioned this pull request Jun 13, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Jun 13, 2022
…nts, r=oli-obk
lint: add diagnostic translation migration lints
Introduce allow-by-default lints for checking whether diagnostics are written in
`SessionDiagnostic` or `AddSubdiagnostic` impls and whether diagnostics are translatable. These lints can be denied for modules once they are fully migrated to impls and translation.
These lints are intended to be temporary - once all diagnostics have been changed then we can just change the APIs we have and that will enforce these constraints thereafter.
r? ```@oli-obk```
@Dylan-DPCDylan-DPC mentioned this pull request Jun 13, 2022
@Dylan-DPCDylan-DPC mentioned this pull request Jun 14, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Jun 14, 2022
…nts, r=oli-obk
lint: add diagnostic translation migration lints
Introduce allow-by-default lints for checking whether diagnostics are written in
`SessionDiagnostic` or `AddSubdiagnostic` impls and whether diagnostics are translatable. These lints can be denied for modules once they are fully migrated to impls and translation.
These lints are intended to be temporary - once all diagnostics have been changed then we can just change the APIs we have and that will enforce these constraints thereafter.
r? ````@oli-obk````
@Dylan-DPCDylan-DPC mentioned this pull request Jun 14, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 14, 2022
Rollup of 5 pull requests
Successful merges:
- rust-lang#97869 (BTree: tweak internal comments)
- rust-lang#97935 (Rename the `ConstS::val` field as `kind`.)
- rust-lang#97948 (lint: add diagnostic translation migration lints)
- rust-lang#98042 (Fix compat_fn option method on miri)
- rust-lang#98069 (rustdoc: remove link on slice brackets)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit d8333a7 into rust-lang:masterJun 14, 2022
@rustbotrustbot added this to the 1.63.0 milestone Jun 14, 2022
@davidtwco
davidtwco deleted the diagnostic-translation-lints branch June 14, 2022 14:29
@compiler-errorscompiler-errors added the A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic label Aug 11, 2022
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-translationArea: Translation infrastructure, and migrating existing diagnostics to SessionDiagnosticS-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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.

6 participants

@davidtwco@oli-obk@bors@compiler-errors@rust-highfive@rustbot