This commit improves mutability error suggestions by suggesting the removal of `&mut` where a mutable borrow is being taken of a `&mut self` or a `self: &mut Self`.
42 lines
1.3 KiB
Plaintext
42 lines
1.3 KiB
Plaintext
error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable
|
|
--> $DIR/issue-51191.rs:17:9
|
|
|
|
|
LL | (&mut self).bar();
|
|
| ^^^^^^^^^^^
|
|
| |
|
|
| cannot borrow as mutable
|
|
| try removing `&mut` here
|
|
|
|
error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable
|
|
--> $DIR/issue-51191.rs:22:9
|
|
|
|
|
LL | fn imm(self) {
|
|
| ---- help: consider changing this to be mutable: `mut self`
|
|
LL | (&mut self).bar();
|
|
| ^^^^^^^^^^^ cannot borrow as mutable
|
|
|
|
error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable
|
|
--> $DIR/issue-51191.rs:31:9
|
|
|
|
|
LL | (&mut self).bar();
|
|
| ^^^^^^^^^^^ cannot borrow as mutable
|
|
|
|
error[E0596]: cannot borrow data in a `&` reference as mutable
|
|
--> $DIR/issue-51191.rs:31:9
|
|
|
|
|
LL | (&mut self).bar();
|
|
| ^^^^^^^^^^^ cannot borrow as mutable
|
|
|
|
error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable
|
|
--> $DIR/issue-51191.rs:37:9
|
|
|
|
|
LL | (&mut self).bar();
|
|
| ^^^^^^^^^^^
|
|
| |
|
|
| cannot borrow as mutable
|
|
| try removing `&mut` here
|
|
|
|
error: aborting due to 5 previous errors
|
|
|
|
For more information about this error, try `rustc --explain E0596`.
|