forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#91516 - rukai:improve_mut_addition_help, r=…
…estebank Improve suggestion to change struct field to &mut r? `@estebank` Now displays a proper underline style suggestion instead of including the code change inline with the message.
- Loading branch information
Showing
4 changed files
with
41 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,25 @@ | ||
error[E0596]: cannot borrow `*self.s` as mutable, as it is behind a `&` reference | ||
--> $DIR/issue-38147-2.rs:7:9 | ||
--> $DIR/issue-38147-2.rs:9:9 | ||
| | ||
LL | s: &'a String | ||
| ---------- help: consider changing this to be mutable: `&'a mut String` | ||
... | ||
LL | self.s.push('x'); | ||
| ^^^^^^^^^^^^^^^^ cannot borrow as mutable | ||
| | ||
help: consider changing this to be mutable | ||
| | ||
LL | s: &'a mut String, | ||
| +++ | ||
|
||
error[E0596]: cannot borrow `*self.longer_name` as mutable, as it is behind a `&` reference | ||
--> $DIR/issue-38147-2.rs:12:9 | ||
| | ||
LL | self.longer_name.push(13); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable | ||
| | ||
help: consider changing this to be mutable | ||
| | ||
LL | longer_name: & 'a mut Vec<u8> | ||
| +++ | ||
|
||
error: aborting due to previous error | ||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0596`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters