Skip to content

Commit f99472f

Browse files
committed
borrow_ck some diagnostic msg migration
1 parent 3ff244b commit f99472f

File tree

10 files changed

+865
-237
lines changed

10 files changed

+865
-237
lines changed

compiler/rustc_borrowck/messages.ftl

Lines changed: 334 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,71 @@
11
borrowck_assign_due_to_use_closure =
22
assignment occurs due to use in closure
33

4+
borrowck_move_unsized =
5+
cannot move a value of type `{$ty}`
6+
.label = the size of `{$ty}` cannot be statically determined
7+
8+
borrowck_higher_ranked_lifetime_error =
9+
higher-ranked lifetime error
10+
11+
borrowck_could_not_prove =
12+
could not prove `{$predicate}`
13+
14+
borrowck_could_not_normalize =
15+
could not normalize `{$value}`
16+
17+
borrowck_higher_ranked_subtype_error =
18+
higher-ranked subtype error
19+
20+
borrowck_generic_does_not_live_long_enough =
21+
`{$kind}` does not live long enough
22+
23+
borrowck_move_borrowed =
24+
cannot move out of `{$desc}` because it is borrowed
25+
26+
borrowck_var_does_not_need_mut =
27+
variable does not need to be mutable
28+
.suggestion = remove this `mut`
29+
30+
borrowck_var_cannot_escape_closure =
31+
captured variable cannot escape `FnMut` closure body
32+
.note = `FnMut` closures only have access to their captured variables while they are executing...
33+
.cannot_escape = ...therefore, they cannot allow references to captured variables to escape
34+
35+
borrowck_var_here_defined = variable defined here
36+
37+
borrowck_var_here_captured = variable captured here
38+
39+
borrowck_closure_inferred_mut = inferred to be a `FnMut` closure
40+
41+
borrowck_returned_closure_escaped =
42+
returns a closure that contains a reference to a captured variable, which then escapes the closure body
43+
44+
borrowck_returned_async_block_escaped =
45+
returns an `async` block that contains a reference to a captured variable, which then escapes the closure body
46+
47+
borrowck_returned_ref_escaped =
48+
returns a reference to a captured variable which escapes the closure body
49+
50+
borrowck_lifetime_constraints_error =
51+
lifetime may not live long enough
52+
53+
borrowck_returned_lifetime_wrong =
54+
{$mir_def_name} was supposed to return data with lifetime `{$outlived_fr_name}` but it is returning data with lifetime `{$fr_name}`
55+
56+
borrowck_returned_lifetime_short =
57+
{$category}requires that `{$free_region_name}` must outlive `{$outlived_fr_name}`
58+
59+
borrowck_used_impl_require_static =
60+
the used `impl` has a `'static` requirement
61+
62+
borrowck_borrow_due_to_use_generator =
63+
borrow occurs due to use in generator
64+
65+
borrowck_use_due_to_use_generator =
66+
use occurs due to use in generator
67+
>>>>>>> borrow_ck some diagnostic msg migration
68+
469
borrowck_assign_due_to_use_generator =
570
assign occurs due to use in generator
671

@@ -193,15 +258,15 @@ borrowck_value_capture_here =
193258
}
194259

195260
borrowck_value_moved_here =
196-
value {$is_partial ->
197-
[true] partially moved
198-
*[false] moved
261+
{$is_partial ->
262+
[true] value partially
263+
*[false] value
199264
} {$is_move_msg ->
200-
[true] into closure here
265+
[true] moved into closure
266+
*[false] moved
267+
} {$is_loop_message ->
268+
[true] here, in previous iteration of loop
201269
*[false] here
202-
}{$is_loop_message ->
203-
[true] , in previous iteration of loop
204-
*[false] {""}
205270
}
206271

207272
borrowck_var_borrow_by_use_in_closure =
@@ -241,6 +306,7 @@ borrowck_var_here_captured = variable captured here
241306

242307
borrowck_var_here_defined = variable defined here
243308

309+
<<<<<<< master
244310
borrowck_var_move_by_use_in_closure =
245311
move occurs due to use in closure
246312

@@ -255,3 +321,264 @@ borrowck_var_second_borrow_by_use_place_in_closure =
255321

256322
borrowck_var_second_borrow_by_use_place_in_generator =
257323
second borrow occurs due to use of {$place} in generator
324+
=======
325+
borrowck_ty_no_impl_copy =
326+
{$is_partial_move ->
327+
[true] partial move
328+
*[false] move
329+
} occurs because {$place} has type `{$ty}`, which does not implement the `Copy` trait
330+
331+
borrowck_data_moved_here =
332+
data moved here
333+
334+
borrowck_and_data_moved_here = ...and here
335+
336+
borrowck_moved_var_cannot_copy =
337+
move occurs because these variables have types that don't implement the `Copy` trait
338+
339+
borrowck_used_here_by_closure =
340+
used here by closure
341+
342+
borrowck_consider_add_semicolon =
343+
consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
344+
345+
borrowck_consider_move_expression_end_of_block =
346+
for example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block
347+
348+
borrowck_consider_forcing_temporary_drop_sooner =
349+
the temporary is part of an expression at the end of a block;
350+
consider forcing this temporary to be dropped sooner, before the block's local variables are dropped
351+
352+
borrowck_perhaps_save_in_new_local_to_drop =
353+
for example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block
354+
355+
borrowck_outlive_constraint_need_borrow_for =
356+
{$category}requires that {$desc} is borrowed for `{$region_name}`
357+
358+
borrowck_outlive_constraint_need_borrow_lasts_for =
359+
{$category}requires that {$borrow_desc} is borrowed for `{$region_name}`
360+
361+
borrowck_consider_add_lifetime_bound =
362+
consider adding the following bound: `{$fr_name}: {$outlived_fr_name}`
363+
364+
borrowck_closure_cannot_invoke_again =
365+
closure cannot be invoked more than once because it moves the variable `{$place}` out of its environment
366+
367+
borrowck_closure_cannot_move_again =
368+
closure cannot be moved more than once as it is not `Copy` due to moving the variable `{$place}` out of its environment
369+
370+
borrowck_consider_borrow_content_of_type =
371+
help: consider calling `.as_ref()` or `.as_mut()` to borrow the type's contents
372+
373+
borrowck_function_takes_self_ownership =
374+
this function takes ownership of the receiver `self`, which moves {$place_name}
375+
376+
borrowck_outlive_constraint_need_borrow_lasts =
377+
{$category}requires that `{$borrow_desc}` lasts for `{$region_name}`
378+
379+
borrowck_require_mutable_binding =
380+
calling `{$place}` requires mutable binding due to {$reason ->
381+
[borrow] mutable borrow of `{$upvar}`
382+
*[mutation] possible mutation of `{$upvar}`
383+
}
384+
385+
borrowck_cannot_act =
386+
cannot {$act}
387+
388+
borrowck_expects_fnmut_not_fn =
389+
change this to accept `FnMut` instead of `Fn`
390+
391+
borrowck_expects_fn_not_fnmut =
392+
expects `Fn` instead of `FnMut`
393+
394+
borrowck_empty_label = {""}
395+
396+
borrowck_in_this_closure =
397+
in this closure
398+
399+
borrowck_return_fnmut =
400+
change this to return `FnMut` instead of `Fn`
401+
402+
borrowck_name_this_region =
403+
let's call this `{$rg_name}`
404+
405+
borrowck_lifetime_appears_in_type =
406+
lifetime `{$rg_name}` appears in the type {$type_name}
407+
408+
borrowck_lifetime_appears_in_type_of =
409+
lifetime `{$rg_name}` appears in the type of `{$upvar_name}`
410+
411+
borrowck_yield_type_is_type =
412+
yield type is {$type_name}
413+
414+
borrowck_lifetime_appears_here_in_impl =
415+
lifetime `{$rg_name}` appears in the `impl`'s {$location}
416+
417+
borrowck_type_parameter_not_used_in_trait_type_alias =
418+
type parameter `{$ty}` is part of concrete type but not used in parameter list for the `impl Trait` type alias
419+
420+
borrowck_non_defining_opaque_type =
421+
non-defining opaque type use in defining scope
422+
423+
borrowck_used_non_generic_for_generic =
424+
used non-generic {$descr ->
425+
[lifetime] lifetime
426+
[type] type
427+
*[constant] constant
428+
} `{$arg}` for generic parameter
429+
430+
borrowck_cannot_use_static_lifetime_here =
431+
cannot use static lifetime; use a bound lifetime instead or remove the lifetime parameter from the opaque type
432+
433+
borrowck_define_inline_constant_type =
434+
defining inline constant type: {$type_name}
435+
436+
borrowck_define_const_type =
437+
defining constant type: {$type_name}
438+
439+
borrowck_define_type =
440+
defining type: {$type_name}
441+
442+
borrowck_define_type_with_generator_substs =
443+
defining type: {$type_name} with generator substs {$subsets}
444+
445+
borrowck_define_type_with_closure_substs =
446+
defining type: {$type_name} with closure substs {$subsets}
447+
448+
borrowck_borrowed_temporary_value_dropped =
449+
temporary value dropped while borrowed
450+
451+
borrowck_thread_local_outlive_function =
452+
thread-local variable borrowed past end of function
453+
454+
borrowck_closure_borrowing_outlive_function =
455+
{$closure_kind} may outlive the current function, but it borrows {$borrowed_path}, which is owned by the current function
456+
.label = may outlive borrowed value {$borrowed_path}
457+
.path_label = {$borrowed_path} is borrowed here
458+
459+
borrowck_cannot_return_ref_to_local =
460+
cannot {$return_kind} {$reference} {$local}
461+
.label = {$return_kind}s a {$reference} data owned by the current function
462+
463+
borrowck_path_does_not_live_long_enough =
464+
{$path} does not live long enough
465+
466+
borrowck_cannot_borrow_across_destructor =
467+
borrow may still be in use when destructor runs
468+
469+
borrowck_cannot_borrow_across_generator_yield =
470+
borrow may still be in use when generator yields
471+
.label = possible yield occurs here
472+
473+
borrowck_cannot_move_out_of_interior_of_drop =
474+
cannot move out of type `{$container_ty}`, which implements the `Drop` trait
475+
.label = cannot move out of here
476+
477+
borrowck_cannot_assign_to_borrowed =
478+
cannot assign to {$desc ->
479+
[value] value
480+
*[other] {$desc}
481+
} because it is borrowed
482+
.label = {$desc ->
483+
[value] value
484+
*[other] {$desc}
485+
} is assigned to here but it was already borrowed
486+
.borrow_here_label = {$desc ->
487+
[value] value
488+
*[other] {$desc}
489+
} is borrowed here
490+
491+
borrowck_cannot_uniquely_borrow_by_two_closures =
492+
two closures require unique access to {$desc ->
493+
[value] value
494+
*[other] {$desc}
495+
} at the same time
496+
.label = borrow from first closure ends here
497+
.new_span_label = second closure is constructed here
498+
499+
borrowck_first_closure_constructed_here =
500+
first closure is constructed here
501+
502+
borrowck_closures_constructed_here =
503+
closures are constructed here in different iterations of loop
504+
505+
borrowck_cannot_use_when_mutably_borrowed =
506+
cannot use {$desc ->
507+
[value] value
508+
*[other] {$desc}
509+
} because it was mutably borrowed
510+
.label = use of borrowed {$borrow_desc ->
511+
[value] value
512+
*[other] {$borrow_desc}
513+
}
514+
.borrow_span_label = {$borrow_desc ->
515+
[value] value
516+
*[other] {$borrow_desc}
517+
} is borrowed here
518+
519+
borrowck_cannot_mutably_borrow_multiply_same_span =
520+
cannot borrow {$is_place_empty ->
521+
*[true] {$new_place_name}
522+
[false] {$new_place_name} (via {$place})
523+
} as mutable more than once at a time
524+
.label = mutable borrow ends here
525+
526+
borrowck_mutably_borrow_multiply_loop_label =
527+
{$is_place_empty ->
528+
*[true] {$new_place_name}
529+
[false] {$new_place_name} (via {$place})
530+
} was mutably borrowed here in the previous iteration of the loop{$place}
531+
532+
borrowck_cannot_mutably_borrow_multiply =
533+
cannot borrow {$is_place_empty ->
534+
*[true] {$new_place_name}
535+
[false] {$new_place_name} (via {$place})
536+
} as mutable more than once at a time
537+
.label = first mutable borrow occurs {$is_old_place_empty ->
538+
*[true] here
539+
[false] here (via {$old_place})
540+
}
541+
.second_mut_borrow_label = second mutable borrow occurs {$is_place_empty ->
542+
*[true] here
543+
[false] here (via {$place})
544+
}
545+
.first_mut_end_label = first borrow ends here
546+
547+
borrowck_cannot_uniquely_borrow_by_one_closure =
548+
closure requires unique access to {$desc_new} but {$noun_old} is already borrowed{$old_opt_via}
549+
.label = {$container_name} construction occurs here{$opt_via}
550+
.occurs_label = borrow occurs here{$old_opt_via}
551+
.ends_label = borrow ends here
552+
553+
borrowck_cannot_reborrow_already_uniquely_borrowed =
554+
cannot borrow {$desc_new}{$opt_via} as {$kind_new} because previous closure requires unique access
555+
.label = {$second_borrow_desc}borrow occurs here{$opt_via}
556+
.occurs_label = {$container_name} construction occurs here{$old_opt_via}
557+
.ends_label = borrow from closure ends here
558+
559+
borrowck_borrow_occurs_here = {$kind} borrow occurs here
560+
561+
borrowck_borrow_occurs_here_overlap =
562+
{$kind_new} borrow of {$msg_new} -- which overlaps with {$msg_old} -- occurs here
563+
564+
borrowck_borrow_occurs_here_via =
565+
{$kind_old} borrow occurs {$is_msg_old_empty ->
566+
*[true] here
567+
[false] here (via {$msg_old})
568+
}
569+
570+
borrowck_cannot_reborrow_already_borrowed =
571+
cannot borrow {$is_msg_new_empty ->
572+
*[true] {$desc_new}
573+
[false] {$desc_new} (via {$msg_new})
574+
} as {$kind_new} because {$noun_old} is also borrowed as {$is_msg_old_empty ->
575+
*[true] {$kind_old}
576+
[false] {$kind_old} (via {$msg_old})
577+
}
578+
.label = {$kind_old} borrow ends here
579+
580+
borrowck_cannot_reassign_immutable_arg =
581+
cannot assign to immutable argument {$place}
582+
583+
borrowck_cannot_reassign_immutable_var =
584+
cannot assign twice to immutable variable {$place}

0 commit comments

Comments
 (0)