Skip to content

Commit 4f35c79

Browse files
committed
lint: port translation migration diagnostics
Signed-off-by: David Wood <david.wood@huawei.com>
1 parent 674ac60 commit 4f35c79

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

compiler/rustc_error_messages/locales/en-US/lint.ftl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,8 @@ lint-lintpass-by-hand = implementing `LintPass` by hand
4949
5050
lint-non-existant-doc-keyword = found non-existing keyword `{$keyword}` used in `#[doc(keyword = \"...\")]`
5151
.help = only existing keywords are allowed in core/std
52+
53+
lint-diag-out-of-impl =
54+
diagnostics should only be created in `SessionDiagnostic`/`AddSubdiagnostic` impls
55+
56+
lint-untranslatable-diag = diagnostics should be created using translatable messages

compiler/rustc_lint/src/internal.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,7 @@ impl LateLintPass<'_> for Diagnostics {
423423
debug!(?found_impl);
424424
if !found_impl {
425425
cx.struct_span_lint(DIAGNOSTIC_OUTSIDE_OF_IMPL, span, |lint| {
426-
lint.build("diagnostics should only be created in `SessionDiagnostic`/`AddSubdiagnostic` impls")
427-
.emit();
426+
lint.build(fluent::lint::diag_out_of_impl).emit();
428427
})
429428
}
430429

@@ -442,7 +441,7 @@ impl LateLintPass<'_> for Diagnostics {
442441
debug!(?found_diagnostic_message);
443442
if !found_diagnostic_message {
444443
cx.struct_span_lint(UNTRANSLATABLE_DIAGNOSTIC, span, |lint| {
445-
lint.build("diagnostics should be created using translatable messages").emit();
444+
lint.build(fluent::lint::untranslatable_diag).emit();
446445
})
447446
}
448447
}

0 commit comments

Comments
 (0)