Skip to content

Commit 3c9bda5

Browse files
committed
lint: port trivial bounds diagnostics
Signed-off-by: David Wood <[email protected]>
1 parent 01a64af commit 3c9bda5

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,3 +366,5 @@ lint-builtin-type-alias-where-clause = where clauses are not enforced in type al
366366
367367
lint-builtin-type-alias-generic-bounds = bounds on generic parameters are not enforced in type aliases
368368
.suggestion = the bound will not be checked when the type alias is used, and should be removed
369+
370+
lint-builtin-trivial-bounds = {$predicate_kind_name} bound {$predicate} does not depend on any type or lifetime parameters

compiler/rustc_lint/src/builtin.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,12 +1671,10 @@ impl<'tcx> LateLintPass<'tcx> for TrivialConstraints {
16711671
};
16721672
if predicate.is_global() {
16731673
cx.struct_span_lint(TRIVIAL_BOUNDS, span, |lint| {
1674-
lint.build(&format!(
1675-
"{} bound {} does not depend on any type \
1676-
or lifetime parameters",
1677-
predicate_kind_name, predicate
1678-
))
1679-
.emit();
1674+
lint.build(fluent::lint::builtin_trivial_bounds)
1675+
.set_arg("predicate_kind_name", predicate_kind_name)
1676+
.set_arg("predicate", predicate)
1677+
.emit();
16801678
});
16811679
}
16821680
}

0 commit comments

Comments
 (0)