rustc_borrowck: make dereference suggestion translatable
This commit is contained in:
parent
67602980de
commit
48413cf078
@ -62,6 +62,9 @@ borrowck_could_not_normalize =
|
||||
borrowck_could_not_prove =
|
||||
could not prove `{$predicate}`
|
||||
|
||||
borrowck_dereference_suggestion =
|
||||
dereference the return value
|
||||
|
||||
borrowck_func_take_self_moved_place =
|
||||
`{$func}` takes ownership of the receiver `self`, which moves {$place_name}
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
LifetimeReturnCategoryErr, RequireStaticErr, VarHereDenote,
|
||||
};
|
||||
use crate::universal_regions::DefiningTy;
|
||||
use crate::{borrowck_errors, MirBorrowckCtxt};
|
||||
use crate::{borrowck_errors, fluent_generated, MirBorrowckCtxt};
|
||||
|
||||
impl<'tcx> ConstraintDescription for ConstraintCategory<'tcx> {
|
||||
fn description(&self) -> &'static str {
|
||||
@ -1045,7 +1045,6 @@ fn suggest_adding_lifetime_params(&self, diag: &mut Diag<'_>, sub: RegionVid, su
|
||||
}
|
||||
|
||||
#[allow(rustc::diagnostic_outside_of_impl)]
|
||||
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
|
||||
/// When encountering a lifetime error caused by the return type of a closure, check the
|
||||
/// corresponding trait bound and see if dereferencing the closure return value would satisfy
|
||||
/// them. If so, we produce a structured suggestion.
|
||||
@ -1166,7 +1165,7 @@ fn suggest_deref_closure_return(&self, diag: &mut Diag<'_>) {
|
||||
if ocx.select_all_or_error().is_empty() && count > 0 {
|
||||
diag.span_suggestion_verbose(
|
||||
tcx.hir().body(*body).value.peel_blocks().span.shrink_to_lo(),
|
||||
"dereference the return value",
|
||||
fluent_generated::borrowck_dereference_suggestion,
|
||||
"*".repeat(count),
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user