2018-08-08 14:28:26 +02:00
|
|
|
error[E0384]: cannot assign twice to immutable variable `x`
|
2019-04-22 08:40:08 +01:00
|
|
|
--> $DIR/mut-pattern-internal-mutability.rs:5:5
|
2018-08-08 14:28:26 +02:00
|
|
|
|
|
|
|
|
LL | let &mut x = foo;
|
|
|
|
| -
|
|
|
|
| |
|
|
|
|
| first assignment to `x`
|
2021-04-12 23:29:09 +01:00
|
|
|
| help: consider making this binding mutable: `mut x`
|
2019-03-17 10:52:07 +01:00
|
|
|
LL | x += 1;
|
2018-08-08 14:28:26 +02:00
|
|
|
| ^^^^^^ cannot assign twice to immutable variable
|
|
|
|
|
|
|
|
error[E0506]: cannot assign to `*foo` because it is borrowed
|
2019-04-22 08:40:08 +01:00
|
|
|
--> $DIR/mut-pattern-internal-mutability.rs:13:5
|
2018-08-08 14:28:26 +02:00
|
|
|
|
|
|
|
|
LL | let &mut ref x = foo;
|
2023-01-15 03:06:44 +00:00
|
|
|
| ----- `*foo` is borrowed here
|
2019-03-17 10:52:07 +01:00
|
|
|
LL | *foo += 1;
|
2023-01-15 03:06:44 +00:00
|
|
|
| ^^^^^^^^^ `*foo` is assigned to here but it was already borrowed
|
2018-08-08 14:28:26 +02:00
|
|
|
LL | drop(x);
|
|
|
|
| - borrow later used here
|
|
|
|
|
|
|
|
error: aborting due to 2 previous errors
|
|
|
|
|
2019-04-17 13:26:38 -04:00
|
|
|
Some errors have detailed explanations: E0384, E0506.
|
2018-08-08 14:28:26 +02:00
|
|
|
For more information about an error, try `rustc --explain E0384`.
|