mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-21 17:52:12 +03:00
71b0755a98
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
```
16 lines
561 B
Plaintext
16 lines
561 B
Plaintext
error[E0594]: cannot assign to `t.v`, which is behind a `&` reference
|
|
--> $DIR/suggest-mut-method-for-loop.rs:14:9
|
|
|
|
|
LL | for mut t in buzz.values() {
|
|
| -------------
|
|
| | |
|
|
| | help: use mutable method: `values_mut()`
|
|
| this iterator yields `&` references
|
|
...
|
|
LL | t.v += 1;
|
|
| ^^^^^^^^ `t` is a `&` reference, so it cannot be written to
|
|
|
|
error: aborting due to 1 previous error
|
|
|
|
For more information about this error, try `rustc --explain E0594`.
|