1
Fork 0

lint: add diagnostic translation migration lints

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>
This commit is contained in:
David Wood 2022-06-10 15:50:06 +01:00
parent 52ee2a2738
commit 5ba81faba6
15 changed files with 327 additions and 37 deletions

View file

@ -311,6 +311,7 @@ impl ParseSess {
self.create_warning(warning).emit()
}
#[cfg_attr(not(bootstrap), rustc_lint_diagnostics)]
pub fn struct_err(
&self,
msg: impl Into<DiagnosticMessage>,
@ -318,6 +319,7 @@ impl ParseSess {
self.span_diagnostic.struct_err(msg)
}
#[cfg_attr(not(bootstrap), rustc_lint_diagnostics)]
pub fn struct_warn(&self, msg: impl Into<DiagnosticMessage>) -> DiagnosticBuilder<'_, ()> {
self.span_diagnostic.struct_warn(msg)
}