From b7d58eef4b9e6bd1aa454c3100815fb5d5481a7b Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 20 Feb 2024 14:12:50 +1100 Subject: 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`. --- compiler/rustc_interface/src/interface.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'compiler/rustc_interface/src/interface.rs') diff --git a/compiler/rustc_interface/src/interface.rs b/compiler/rustc_interface/src/interface.rs index 3a2bbed19be..820626173a8 100644 --- a/compiler/rustc_interface/src/interface.rs +++ b/compiler/rustc_interface/src/interface.rs @@ -318,6 +318,7 @@ pub struct Config { // JUSTIFICATION: before session exists, only config #[allow(rustc::bad_opt_access)] +#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable pub fn run_compiler(config: Config, f: impl FnOnce(&Compiler) -> R + Send) -> R { trace!("run_compiler"); -- cgit 1.4.1-3-g733a5