Point at statics and consts being mutable borrowed or written to:
```
error[E0594]: cannot assign to immutable static item `NUM`
--> $DIR/E0594.rs:4:5
|
LL | static NUM: i32 = 18;
| --------------- this `static` cannot be written to
...
LL | NUM = 20;
| ^^^^^^^^ cannot assign
```
Point at the expression that couldn't be mutably borrowed from a pattern:
```
error[E0596]: cannot borrow data in a `&` reference as mutable
--> $DIR/mut-pattern-of-immutable-borrow.rs:19:14
|
LL | match &arg.field {
| ---------- this cannot be borrowed as mutable
LL | Some(ref mut s) => s.push('a'),
| ^^^^^^^^^ cannot borrow as mutable
```
14 lines
462 B
Text
14 lines
462 B
Text
error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
|
|
--> $DIR/slice-mut-2.rs:7:18
|
|
|
|
|
LL | let _ = &mut x[2..4];
|
|
| ^ `x` is a `&` reference, so it cannot be borrowed as mutable
|
|
|
|
|
help: consider changing this binding's type
|
|
|
|
|
LL | let x: &mut [isize] = &[1, 2, 3, 4, 5];
|
|
| +++
|
|
|
|
error: aborting due to 1 previous error
|
|
|
|
For more information about this error, try `rustc --explain E0596`.
|