Skip to content

Commit 84b168f

Browse files
committed
borrow_ck some diagnostic msg migration
1 parent 165cdda commit 84b168f

File tree

10 files changed

+859
-228
lines changed

10 files changed

+859
-228
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

@@ -194,15 +259,15 @@ borrowck_value_capture_here =
194259
}
195260

196261
borrowck_value_moved_here =
197-
value {$is_partial ->
198-
[true] partially moved
199-
*[false] moved
262+
{$is_partial ->
263+
[true] value partially
264+
*[false] value
200265
} {$is_move_msg ->
201-
[true] into closure here
266+
[true] moved into closure
267+
*[false] moved
268+
} {$is_loop_message ->
269+
[true] here, in previous iteration of loop
202270
*[false] here
203-
}{$is_loop_message ->
204-
[true] , in previous iteration of loop
205-
*[false] {""}
206271
}
207272

208273
borrowck_var_borrow_by_use_in_closure =
@@ -242,6 +307,7 @@ borrowck_var_here_captured = variable captured here
242307

243308
borrowck_var_here_defined = variable defined here
244309

310+
<<<<<<< master
245311
borrowck_var_move_by_use_in_closure =
246312
move occurs due to use in closure
247313

@@ -262,3 +328,264 @@ borrowck_var_second_borrow_by_use_place_in_closure =
262328

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

0 commit comments

Comments
 (0)