From 10f2d3f566d4271ee95b9b1ae51dbf51b4aa1707 Mon Sep 17 00:00:00 2001 From: David Wood Date: Tue, 28 Jun 2022 14:20:10 +0100 Subject: [PATCH] lint: port test items diagnostics Signed-off-by: David Wood --- compiler/rustc_error_messages/locales/en-US/lint.ftl | 2 ++ compiler/rustc_lint/src/builtin.rs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_error_messages/locales/en-US/lint.ftl b/compiler/rustc_error_messages/locales/en-US/lint.ftl index 7310f4c241f..4d1aca61105 100644 --- a/compiler/rustc_error_messages/locales/en-US/lint.ftl +++ b/compiler/rustc_error_messages/locales/en-US/lint.ftl @@ -371,3 +371,5 @@ lint-builtin-trivial-bounds = {$predicate_kind_name} bound {$predicate} does not lint-builtin-ellipsis-inclusive-range-patterns = `...` range patterns are deprecated .suggestion = use `..=` for an inclusive range + +lint-builtin-unnameable-test-items = cannot test inner items diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index 7c9e9a31e1e..df30ea93708 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -1915,7 +1915,7 @@ fn check_item(&mut self, cx: &LateContext<'_>, it: &hir::Item<'_>) { let attrs = cx.tcx.hir().attrs(it.hir_id()); if let Some(attr) = cx.sess().find_by_name(attrs, sym::rustc_test_marker) { cx.struct_span_lint(UNNAMEABLE_TEST_ITEMS, attr.span, |lint| { - lint.build("cannot test inner items").emit(); + lint.build(fluent::lint::builtin_unnameable_test_items).emit(); }); } }