-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
lint: add diagnostic translation migration lints #97948
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>
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(); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
@bors r+ |
📌 Commit 5ba81fa has been approved by |
…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`
…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``
…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```
…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````
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
Introduce allow-by-default lints for checking whether diagnostics are written in
SessionDiagnostic
orAddSubdiagnostic
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