rustc_borrowck: make suggestion to move closure translatable

This commit is contained in:
Pavel Grigorenko 2024-08-08 23:58:42 +03:00
parent 48413cf078
commit 446e03e3c9
2 changed files with 4 additions and 2 deletions

View File

@ -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

View File

@ -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,
);