Skip to content

Commit a058251

Browse files
committed
eager_diag issue on diag struct
1 parent fa08e05 commit a058251

File tree

2 files changed

+23
-30
lines changed

2 files changed

+23
-30
lines changed

compiler/rustc_borrowck/messages.ftl

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,37 +24,37 @@ borrowck_assign_part_due_to_use_generator =
2424
assign to part occurs due to use in generator
2525
2626
borrowck_assign_place_behind_const_pointer =
27-
cannot assign to {$place}, which is behind a `*const` pointer
27+
cannot assign to `{$place}`, which is behind a `*const` pointer
2828
2929
borrowck_assign_place_behind_deref =
30-
cannot assign to {$place}, which is behind {$name}
30+
cannot assign to `{$place}`, which is behind {$name}
3131
3232
borrowck_assign_place_behind_index =
33-
cannot assign to {$place}, which is behind an index of {$ty}
33+
cannot assign to `{$place}`, which is behind an index of {$ty}
3434
3535
borrowck_assign_place_behind_ref =
36-
cannot assign to {$place}, which is behind a `&` reference
36+
cannot assign to `{$place}`, which is behind a `&` reference
3737
3838
borrowck_assign_place_declared_immute =
39-
cannot assign to {$place}, as it is not declared as mutable
39+
cannot assign to `{$place}`, as it is not declared as mutable
4040
4141
borrowck_assign_place_in_fn =
42-
cannot assign to {$place}, as it is a captured variable in a `Fn` closure
42+
cannot assign to `{$place}`, as it is a captured variable in a `Fn` closure
4343
4444
borrowck_assign_place_in_pattern_guard_immute =
45-
cannot assign to {$place}, as it is immutable for the pattern guard
45+
cannot assign to `{$place}`, as it is immutable for the pattern guard
4646
4747
borrowck_assign_place_static =
48-
cannot assign to immutable static item {$place}
48+
cannot assign to immutable static item `{$place}`
4949
5050
borrowck_assign_symbol_declared_immute =
51-
cannot assign to {$place}, as `{$name}` is not declared as mutable
51+
cannot assign to `{$place}`, as `{$name}` is not declared as mutable
5252
5353
borrowck_assign_symbol_static =
54-
cannot assign to {$place}, as `{$static_name}` is an immutable static item
54+
cannot assign to `{$place}`, as `{$static_name}` is an immutable static item
5555
5656
borrowck_assign_upvar_in_fn =
57-
cannot assign to {$place}, as `Fn` closures cannot mutate their captured variables
57+
cannot assign to `{$place}`, as `Fn` closures cannot mutate their captured variables
5858
5959
borrowck_borrow_due_to_use_closure =
6060
borrow occurs due to use in closure
@@ -396,37 +396,37 @@ borrowck_mut_borrow_data_behind_ref =
396396
cannot borrow data in a `&` reference as mutable
397397
398398
borrowck_mut_borrow_place_declared_immute =
399-
cannot borrow {$place} as mutable, as it is not declared as mutable
399+
cannot borrow `{$place}` as mutable, as it is not declared as mutable
400400
401401
borrowck_mut_borrow_place_in_pattern_guard_immute =
402-
cannot borrow {$place} as mutable, as it is immutable for the pattern guard
402+
cannot borrow `{$place}` as mutable, as it is immutable for the pattern guard
403403
404404
borrowck_mut_borrow_place_static =
405-
cannot borrow immutable static item {$place} as mutable
405+
cannot borrow immutable static item `{$place}` as mutable
406406
407407
borrowck_mut_borrow_self_behind_const_pointer =
408-
cannot borrow {$place} as mutable, as it is behind a `*const` pointer
408+
cannot borrow `{$place}` as mutable, as it is behind a `*const` pointer
409409
410410
borrowck_mut_borrow_self_behind_deref =
411-
cannot borrow {$place} as mutable, as it is behind {$name}
411+
cannot borrow `{$place}` as mutable, as it is behind {$name}
412412
413413
borrowck_mut_borrow_self_behind_index =
414-
cannot borrow {$place} as mutable, as it is behind an index of {$name}
414+
cannot borrow `{$place}` as mutable, as it is behind an index of {$name}
415415
416416
borrowck_mut_borrow_self_behind_ref =
417-
cannot borrow {$place} as mutable, as it is behind a `&` reference
417+
cannot borrow `{$place}` as mutable, as it is behind a `&` reference
418418
419419
borrowck_mut_borrow_self_in_fn =
420-
cannot borrow {$place} as mutable, as it is a captured variable in a `Fn` closure
420+
cannot borrow `{$place}` as mutable, as it is a captured variable in a `Fn` closure
421421
422422
borrowck_mut_borrow_symbol_declared_immute =
423-
cannot borrow {$place} as mutable, as `{$name}` is not declared as mutable
423+
cannot borrow `{$place}` as mutable, as `{$name}` is not declared as mutable
424424
425425
borrowck_mut_borrow_symbol_static =
426-
cannot borrow {$place} as mutable, as `{$static_name}` is an immutable static item
426+
cannot borrow `{$place}` as mutable, as `{$static_name}` is an immutable static item
427427
428428
borrowck_mut_borrow_upvar_in_fn =
429-
cannot borrow {$place} as mutable, as `Fn` closures cannot mutate their captured variables
429+
cannot borrow `{$place}` as mutable, as `Fn` closures cannot mutate their captured variables
430430
431431
borrowck_mutably_borrow_multiply_loop_label =
432432
{$is_place_empty ->

compiler/rustc_borrowck/src/diagnostics/mod.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,7 @@ pub(super) struct DescribedPlace(pub(super) Option<String>);
6767

6868
impl IntoDiagnosticArg for DescribedPlace {
6969
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
70-
let mut desc = self.0;
71-
desc.as_mut().map(|s| {
72-
s.reserve(2);
73-
s.insert(0, '`');
74-
s.push('`');
75-
s
76-
});
77-
match desc {
70+
match self.0 {
7871
Some(descr) => descr.into_diagnostic_arg(),
7972
None => "value".into_diagnostic_arg(),
8073
}

0 commit comments

Comments
 (0)