Auto merge of #54831 - davidtwco:issue-52663-struct-field-suggestion, r=nikomatsakis
NLL is missing struct field suggestion Part of #52663. This commit adds suggestions to change the definitions of fields in struct definitions from immutable references to mutable references. r? @nikomatsakis cc @pnkfelix
This commit is contained in:
commit
71d3a71572
3 changed files with 89 additions and 0 deletions
|
|
@ -1,6 +1,9 @@
|
|||
error[E0596]: cannot borrow `*self.s` as mutable, as it is behind a `&` reference
|
||||
--> $DIR/issue-38147-2.rs:17:9
|
||||
|
|
||||
LL | s: &'a String
|
||||
| ---------- help: consider changing this to be mutable: `&'a mut String`
|
||||
...
|
||||
LL | self.s.push('x');
|
||||
| ^^^^^^ cannot borrow as mutable
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
error[E0596]: cannot borrow `*self.s` as mutable, as it is behind a `&` reference
|
||||
--> $DIR/issue-38147-3.rs:17:9
|
||||
|
|
||||
LL | s: &'a String
|
||||
| ---------- help: consider changing this to be mutable: `&'a mut String`
|
||||
...
|
||||
LL | self.s.push('x');
|
||||
| ^^^^^^ cannot borrow as mutable
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue