From 446e03e3c92dedcf90aea3069e40d19dae6772f2 Mon Sep 17 00:00:00 2001 From: Pavel Grigorenko Date: Thu, 8 Aug 2024 23:58:42 +0300 Subject: [PATCH] rustc_borrowck: make suggestion to move closure translatable --- compiler/rustc_borrowck/messages.ftl | 3 +++ compiler/rustc_borrowck/src/diagnostics/region_errors.rs | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_borrowck/messages.ftl b/compiler/rustc_borrowck/messages.ftl index 2b1c82a461e..090bd2293d3 100644 --- a/compiler/rustc_borrowck/messages.ftl +++ b/compiler/rustc_borrowck/messages.ftl @@ -80,6 +80,9 @@ borrowck_higher_ranked_subtype_error = borrowck_lifetime_constraints_error = lifetime may not live long enough +borrowck_move_closure_suggestion = + consider adding 'move' keyword before the nested closure + borrowck_move_out_place_here = {$place} is moved here diff --git a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs index 6b6c7911d76..74c74de3404 100644 --- a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs @@ -1173,7 +1173,6 @@ fn suggest_deref_closure_return(&self, diag: &mut Diag<'_>) { } #[allow(rustc::diagnostic_outside_of_impl)] - #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable fn suggest_move_on_borrowing_closure(&self, diag: &mut Diag<'_>) { let map = self.infcx.tcx.hir(); let body = map.body_owned_by(self.mir_def_id()); @@ -1212,7 +1211,7 @@ fn suggest_move_on_borrowing_closure(&self, diag: &mut Diag<'_>) { if let Some(closure_span) = closure_span { diag.span_suggestion_verbose( closure_span, - "consider adding 'move' keyword before the nested closure", + fluent_generated::borrowck_move_closure_suggestion, "move ", Applicability::MaybeIncorrect, );