address code review comments
This commit is contained in:
parent
7745b52524
commit
311a8bef6e
3 changed files with 5 additions and 5 deletions
|
|
@ -1566,7 +1566,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
|
|||
|
||||
if place != place_err {
|
||||
if let Some(name) = self.describe_place(place_err) {
|
||||
err.note(&format!("Value not mutable causing this error: `{}`", name));
|
||||
err.note(&format!("value not mutable causing this error: `{}`", name));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1619,13 +1619,13 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
|
|||
err.span_label(span, sec_span);
|
||||
}
|
||||
err.emit()
|
||||
}else{
|
||||
} else {
|
||||
let item_msg_ = self.get_main_error_message(place);
|
||||
let mut err = self.tcx.cannot_assign(span, &item_msg_, Origin::Mir, false);
|
||||
err.span_label(span, "cannot mutate");
|
||||
if place != place_err {
|
||||
if let Some(name) = self.describe_place(place_err) {
|
||||
err.note(&format!("Value not mutable causing this error: `{}`",
|
||||
err.note(&format!("value not mutable causing this error: `{}`",
|
||||
name));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,6 @@ struct FancyNum {
|
|||
fn main() {
|
||||
let mut fancy = FancyNum{ num: 5 };
|
||||
let fancy_ref = &(&mut fancy);
|
||||
fancy_ref.num = 6;
|
||||
fancy_ref.num = 6; //~^ ERROR E0594
|
||||
println!("{}", fancy_ref.num);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ error[E0594]: cannot assign through `&`-reference `fancy_ref`
|
|||
|
|
||||
LL | let fancy_ref = &(&mut fancy);
|
||||
| ------------- help: consider changing this to be a mutable reference: `&mut`
|
||||
LL | fancy_ref.num = 6;
|
||||
LL | fancy_ref.num = 6; //~^ ERROR E0594
|
||||
| ^^^^^^^^^^^^^^^^^ cannot assign through `&`-reference
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue