about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPavel Grigorenko <GrigorenkoPV@ya.ru>2024-08-09 00:21:00 +0300
committerPavel Grigorenko <GrigorenkoPV@ya.ru>2024-08-10 14:32:55 +0300
commit1481ab3f75573848a62a492b177054e8a96badfe (patch)
tree7757d29912a94f8dfa60ea2deac98c6bd6d72ded
parent1b6cc24c20557e1a34a5c889bd771924d5c572c5 (diff)
downloadrust-1481ab3f75573848a62a492b177054e8a96badfe.tar.gz
rust-1481ab3f75573848a62a492b177054e8a96badfe.zip
rustc_borrowck: make "implicit static" suff translatable
-rw-r--r--compiler/rustc_borrowck/messages.ftl9
-rw-r--r--compiler/rustc_borrowck/src/diagnostics/region_errors.rs7
2 files changed, 12 insertions, 4 deletions
diff --git a/compiler/rustc_borrowck/messages.ftl b/compiler/rustc_borrowck/messages.ftl
index 7eed4e379c8..edb25e12864 100644
--- a/compiler/rustc_borrowck/messages.ftl
+++ b/compiler/rustc_borrowck/messages.ftl
@@ -77,6 +77,15 @@ borrowck_higher_ranked_lifetime_error =
 borrowck_higher_ranked_subtype_error =
     higher-ranked subtype error
 
+borrowck_implicit_static =
+    this has an implicit `'static` lifetime requirement
+
+borrowck_implicit_static_introduced =
+    calling this method introduces the `impl`'s `'static` requirement
+
+borrowck_implicit_static_relax =
+    consider relaxing the implicit `'static` requirement
+
 borrowck_lifetime_constraints_error =
     lifetime may not live long enough
 
diff --git a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs
index fe2a575ba8b..a0be17e8b51 100644
--- a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs
+++ b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs
@@ -975,7 +975,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
     }
 
     #[allow(rustc::diagnostic_outside_of_impl)]
-    #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
     #[instrument(skip(self, err), level = "debug")]
     fn suggest_constrain_dyn_trait_in_impl(
         &self,
@@ -994,15 +993,15 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
             for span in &traits {
                 let mut multi_span: MultiSpan = vec![*span].into();
                 multi_span
-                    .push_span_label(*span, "this has an implicit `'static` lifetime requirement");
+                    .push_span_label(*span, fluent_generated::borrowck_implicit_static);
                 multi_span.push_span_label(
                     ident.span,
-                    "calling this method introduces the `impl`'s `'static` requirement",
+                    fluent_generated::borrowck_implicit_static_introduced,
                 );
                 err.subdiagnostic(RequireStaticErr::UsedImpl { multi_span });
                 err.span_suggestion_verbose(
                     span.shrink_to_hi(),
-                    "consider relaxing the implicit `'static` requirement",
+                    fluent_generated::borrowck_implicit_static_relax,
                     " + '_",
                     Applicability::MaybeIncorrect,
                 );