lint: port translation migration diagnostics
Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
parent
674ac60d5a
commit
4f35c7993b
2 changed files with 7 additions and 3 deletions
|
@ -49,3 +49,8 @@ lint-lintpass-by-hand = implementing `LintPass` by hand
|
||||||
|
|
||||||
lint-non-existant-doc-keyword = found non-existing keyword `{$keyword}` used in `#[doc(keyword = \"...\")]`
|
lint-non-existant-doc-keyword = found non-existing keyword `{$keyword}` used in `#[doc(keyword = \"...\")]`
|
||||||
.help = only existing keywords are allowed in core/std
|
.help = only existing keywords are allowed in core/std
|
||||||
|
|
||||||
|
lint-diag-out-of-impl =
|
||||||
|
diagnostics should only be created in `SessionDiagnostic`/`AddSubdiagnostic` impls
|
||||||
|
|
||||||
|
lint-untranslatable-diag = diagnostics should be created using translatable messages
|
||||||
|
|
|
@ -423,8 +423,7 @@ impl LateLintPass<'_> for Diagnostics {
|
||||||
debug!(?found_impl);
|
debug!(?found_impl);
|
||||||
if !found_impl {
|
if !found_impl {
|
||||||
cx.struct_span_lint(DIAGNOSTIC_OUTSIDE_OF_IMPL, span, |lint| {
|
cx.struct_span_lint(DIAGNOSTIC_OUTSIDE_OF_IMPL, span, |lint| {
|
||||||
lint.build("diagnostics should only be created in `SessionDiagnostic`/`AddSubdiagnostic` impls")
|
lint.build(fluent::lint::diag_out_of_impl).emit();
|
||||||
.emit();
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,7 +441,7 @@ impl LateLintPass<'_> for Diagnostics {
|
||||||
debug!(?found_diagnostic_message);
|
debug!(?found_diagnostic_message);
|
||||||
if !found_diagnostic_message {
|
if !found_diagnostic_message {
|
||||||
cx.struct_span_lint(UNTRANSLATABLE_DIAGNOSTIC, span, |lint| {
|
cx.struct_span_lint(UNTRANSLATABLE_DIAGNOSTIC, span, |lint| {
|
||||||
lint.build("diagnostics should be created using translatable messages").emit();
|
lint.build(fluent::lint::untranslatable_diag).emit();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue