Skip to content

Commit acea23e

Browse files
committed
lint: port explicit outlives diagnostics
Signed-off-by: David Wood <david.wood@huawei.com>
1 parent 1067641 commit acea23e

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,3 +376,9 @@ lint-builtin-unnameable-test-items = cannot test inner items
376376
377377
lint-builtin-keyword-idents = `{$kw}` is a keyword in the {$next} edition
378378
.suggestion = you can use a raw identifier to stay compatible
379+
380+
lint-builtin-explicit-outlives = outlives requirements can be inferred
381+
.suggestion = remove {$count ->
382+
[one] this bound
383+
*[other] these bounds
384+
}

compiler/rustc_lint/src/builtin.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2288,13 +2288,10 @@ impl<'tcx> LateLintPass<'tcx> for ExplicitOutlivesRequirements {
22882288

22892289
if !lint_spans.is_empty() {
22902290
cx.struct_span_lint(EXPLICIT_OUTLIVES_REQUIREMENTS, lint_spans.clone(), |lint| {
2291-
lint.build("outlives requirements can be inferred")
2291+
lint.build(fluent::lint::builtin_explicit_outlives)
2292+
.set_arg("count", bound_count)
22922293
.multipart_suggestion(
2293-
if bound_count == 1 {
2294-
"remove this bound"
2295-
} else {
2296-
"remove these bounds"
2297-
},
2294+
fluent::lint::suggestion,
22982295
lint_spans
22992296
.into_iter()
23002297
.map(|span| (span, String::new()))

0 commit comments

Comments
 (0)