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
d602394827
commit
b7d58eef4b
35 changed files with 224 additions and 63 deletions
|
@ -621,12 +621,13 @@ pub trait LintContext {
|
|||
/// Note that this function should only be called for [`LintExpectationId`]s
|
||||
/// retrieved from the current lint pass. Buffered or manually created ids can
|
||||
/// cause ICEs.
|
||||
#[rustc_lint_diagnostics]
|
||||
fn fulfill_expectation(&self, expectation: LintExpectationId) {
|
||||
// We need to make sure that submitted expectation ids are correctly fulfilled suppressed
|
||||
// and stored between compilation sessions. To not manually do these steps, we simply create
|
||||
// a dummy diagnostic and emit is as usual, which will be suppressed and stored like a normal
|
||||
// expected lint diagnostic.
|
||||
// a dummy diagnostic and emit it as usual, which will be suppressed and stored like a
|
||||
// normal expected lint diagnostic.
|
||||
#[allow(rustc::diagnostic_outside_of_impl)]
|
||||
#[allow(rustc::untranslatable_diagnostic)]
|
||||
self.sess()
|
||||
.dcx()
|
||||
.struct_expect(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue