Skip to content

Commit 1481ab3

Browse files
committed
rustc_borrowck: make "implicit static" suff translatable
1 parent 1b6cc24 commit 1481ab3

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

compiler/rustc_borrowck/messages.ftl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ borrowck_higher_ranked_lifetime_error =
7777
borrowck_higher_ranked_subtype_error =
7878
higher-ranked subtype error
7979
80+
borrowck_implicit_static =
81+
this has an implicit `'static` lifetime requirement
82+
83+
borrowck_implicit_static_introduced =
84+
calling this method introduces the `impl`'s `'static` requirement
85+
86+
borrowck_implicit_static_relax =
87+
consider relaxing the implicit `'static` requirement
88+
8089
borrowck_lifetime_constraints_error =
8190
lifetime may not live long enough
8291

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
975975
}
976976

977977
#[allow(rustc::diagnostic_outside_of_impl)]
978-
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
979978
#[instrument(skip(self, err), level = "debug")]
980979
fn suggest_constrain_dyn_trait_in_impl(
981980
&self,
@@ -994,15 +993,15 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
994993
for span in &traits {
995994
let mut multi_span: MultiSpan = vec![*span].into();
996995
multi_span
997-
.push_span_label(*span, "this has an implicit `'static` lifetime requirement");
996+
.push_span_label(*span, fluent_generated::borrowck_implicit_static);
998997
multi_span.push_span_label(
999998
ident.span,
1000-
"calling this method introduces the `impl`'s `'static` requirement",
999+
fluent_generated::borrowck_implicit_static_introduced,
10011000
);
10021001
err.subdiagnostic(RequireStaticErr::UsedImpl { multi_span });
10031002
err.span_suggestion_verbose(
10041003
span.shrink_to_hi(),
1005-
"consider relaxing the implicit `'static` requirement",
1004+
fluent_generated::borrowck_implicit_static_relax,
10061005
" + '_",
10071006
Applicability::MaybeIncorrect,
10081007
);

0 commit comments

Comments
 (0)