From fedd4c63f8d49699b7844490503a63c9207d851a Mon Sep 17 00:00:00 2001 From: David Wood Date: Tue, 28 Jun 2022 15:16:49 +0100 Subject: [PATCH] lint: port asm labels diagnostics Signed-off-by: David Wood --- compiler/rustc_error_messages/locales/en-US/lint.ftl | 2 ++ compiler/rustc_lint/src/builtin.rs | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_error_messages/locales/en-US/lint.ftl b/compiler/rustc_error_messages/locales/en-US/lint.ftl index 6a7d8a75450..e7e07093c03 100644 --- a/compiler/rustc_error_messages/locales/en-US/lint.ftl +++ b/compiler/rustc_error_messages/locales/en-US/lint.ftl @@ -396,3 +396,5 @@ lint-builtin-clashing-extern-diff-name = `{$this_fi}` redeclares `{$orig}` with lint-builtin-deref-nullptr = dereferencing a null pointer .label = this code causes undefined behavior when executed + +lint-builtin-asm-labels = avoid using named labels in inline assembly diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index 6197c240f54..428af513498 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -3182,9 +3182,7 @@ impl<'tcx> LateLintPass<'tcx> for NamedAsmLabels { NAMED_ASM_LABELS, Some(target_spans), |diag| { - let mut err = - diag.build("avoid using named labels in inline assembly"); - err.emit(); + diag.build(fluent::lint::builtin_asm_labels).emit(); }, BuiltinLintDiagnostics::NamedAsmLabel( "only local labels of the form `:` should be used in inline asm"