Skip to content

Commit 677c1d8

Browse files
committed
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`.
1 parent fe9ceab commit 677c1d8

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/parse/session.rs

+1
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@ mod tests {
383383
}
384384

385385
fn build_diagnostic(level: DiagnosticLevel, span: Option<MultiSpan>) -> DiagInner {
386+
#[allow(rustc::untranslatable_diagnostic)] // no translation needed for empty string
386387
let mut diag = DiagInner::new(level, "");
387388
diag.messages.clear();
388389
if let Some(span) = span {

0 commit comments

Comments
 (0)