Rewrite the untranslatable_diagnostic
lint.
Currently it only checks calls to functions marked with `#[rustc_lint_diagnostics]`. This commit changes it to check calls to any function with an `impl Into<{D,Subd}iagMessage>` parameter. This greatly improves its coverage and doesn't rely on people remembering to add `#[rustc_lint_diagnostics]`. The commit also adds `#[allow(rustc::untranslatable_diagnostic)`] attributes to places that need it that are caught by the improved lint. These places that might be easy to convert to translatable diagnostics. Finally, it also: - Expands and corrects some comments. - Does some minor formatting improvements. - Adds missing `DecorateLint` cases to `tests/ui-fulldeps/internal-lints/diagnostics.rs`.
This commit is contained in:
parent
fe9ceab356
commit
677c1d8059
@ -383,6 +383,7 @@ fn emit_diagnostic(&mut self, _diag: DiagInner) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn build_diagnostic(level: DiagnosticLevel, span: Option<MultiSpan>) -> DiagInner {
|
fn build_diagnostic(level: DiagnosticLevel, span: Option<MultiSpan>) -> DiagInner {
|
||||||
|
#[allow(rustc::untranslatable_diagnostic)] // no translation needed for empty string
|
||||||
let mut diag = DiagInner::new(level, "");
|
let mut diag = DiagInner::new(level, "");
|
||||||
diag.messages.clear();
|
diag.messages.clear();
|
||||||
if let Some(span) = span {
|
if let Some(span) = span {
|
||||||
|
Loading…
Reference in New Issue
Block a user