about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Wood <david.wood@huawei.com>2022-06-28 14:09:25 +0100
committerDavid Wood <david.wood@huawei.com>2022-06-30 08:59:22 +0100
commit3c9bda5b20139844a1b31960f9fc13349a52048d (patch)
tree321fb5eb643fc2938f2f8ca6874756a0f3fc2b94
parent01a64af4dd30a95e52f525ba621ff05c236b3931 (diff)
downloadrust-3c9bda5b20139844a1b31960f9fc13349a52048d.tar.gz
rust-3c9bda5b20139844a1b31960f9fc13349a52048d.zip
lint: port trivial bounds diagnostics
Signed-off-by: David Wood <david.wood@huawei.com>
-rw-r--r--compiler/rustc_error_messages/locales/en-US/lint.ftl2
-rw-r--r--compiler/rustc_lint/src/builtin.rs10
2 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_error_messages/locales/en-US/lint.ftl b/compiler/rustc_error_messages/locales/en-US/lint.ftl
index bf69db38b42..cdc3cab8fee 100644
--- a/compiler/rustc_error_messages/locales/en-US/lint.ftl
+++ b/compiler/rustc_error_messages/locales/en-US/lint.ftl
@@ -366,3 +366,5 @@ lint-builtin-type-alias-where-clause = where clauses are not enforced in type al
 
 lint-builtin-type-alias-generic-bounds = bounds on generic parameters are not enforced in type aliases
     .suggestion = the bound will not be checked when the type alias is used, and should be removed
+
+lint-builtin-trivial-bounds = {$predicate_kind_name} bound {$predicate} does not depend on any type or lifetime parameters
diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs
index 0c109763d50..1098fd8c14c 100644
--- a/compiler/rustc_lint/src/builtin.rs
+++ b/compiler/rustc_lint/src/builtin.rs
@@ -1671,12 +1671,10 @@ impl<'tcx> LateLintPass<'tcx> for TrivialConstraints {
                 };
                 if predicate.is_global() {
                     cx.struct_span_lint(TRIVIAL_BOUNDS, span, |lint| {
-                        lint.build(&format!(
-                            "{} bound {} does not depend on any type \
-                                or lifetime parameters",
-                            predicate_kind_name, predicate
-                        ))
-                        .emit();
+                        lint.build(fluent::lint::builtin_trivial_bounds)
+                            .set_arg("predicate_kind_name", predicate_kind_name)
+                            .set_arg("predicate", predicate)
+                            .emit();
                     });
                 }
             }