lint: add diagnostic translation migration lints#97948
Merged
bors merged 1 commit intorust-lang:masterfrom Jun 14, 2022
Merged
Conversation
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>
oli-obk
reviewed
Jun 13, 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(); |
Contributor
There was a problem hiding this comment.
Please include some more info, even if it's just a link to the soon-to-be-merged dev guide entry
Contributor
There was a problem hiding this comment.
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?
Member
Author
There was a problem hiding this comment.
yeah, they're really just to prevent us from regressing as we migrate to impls/translation module-by-module
Contributor
|
@bors r+ |
Collaborator
|
📌 Commit 5ba81fa has been approved by |
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-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-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-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````
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduce allow-by-default lints for checking whether diagnostics are written in
SessionDiagnosticorAddSubdiagnosticimpls 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