rust/src/test/ui/borrowck/mut-borrow-of-mut-ref.stderr
Yaron Tausky 3303e6847b Suggest not mutably borrowing a mutable reference
This commit is concerned with the case where the user tries to mutably
borrow a mutable reference, thereby triggering an error. Instead of the
existing suggestion to make the binding mutable, the compiler will now
suggest to avoid borrowing altogether.
2018-06-01 23:17:10 +02:00

14 lines
445 B
Plaintext

error[E0596]: cannot borrow immutable argument `b` as mutable
--> $DIR/mut-borrow-of-mut-ref.rs:18:12
|
LL | g(&mut b) //~ ERROR cannot borrow
| ^ cannot borrow mutably
help: consider removing the `&mut`, as it is an immutable binding to a mutable reference
|
LL | g(b) //~ ERROR cannot borrow
| ^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0596`.