]>
Commit | Line | Data |
---|---|---|
b7449926 | 1 | error[E0384]: cannot assign twice to immutable variable `x` |
48663c56 | 2 | --> $DIR/mut-pattern-internal-mutability.rs:5:5 |
b7449926 XL |
3 | | |
4 | LL | let &mut x = foo; | |
5 | | - | |
6 | | | | |
7 | | first assignment to `x` | |
cdc7bbd5 | 8 | | help: consider making this binding mutable: `mut x` |
532ac7d7 | 9 | LL | x += 1; |
b7449926 XL |
10 | | ^^^^^^ cannot assign twice to immutable variable |
11 | ||
12 | error[E0506]: cannot assign to `*foo` because it is borrowed | |
48663c56 | 13 | --> $DIR/mut-pattern-internal-mutability.rs:13:5 |
b7449926 XL |
14 | | |
15 | LL | let &mut ref x = foo; | |
16 | | ----- borrow of `*foo` occurs here | |
532ac7d7 | 17 | LL | *foo += 1; |
b7449926 | 18 | | ^^^^^^^^^ assignment to borrowed `*foo` occurs here |
b7449926 XL |
19 | LL | drop(x); |
20 | | - borrow later used here | |
21 | ||
22 | error: aborting due to 2 previous errors | |
23 | ||
48663c56 | 24 | Some errors have detailed explanations: E0384, E0506. |
b7449926 | 25 | For more information about an error, try `rustc --explain E0384`. |