2024-03-23 20:04:45 -05:00
|
|
|
error[E0384]: cannot assign twice to immutable variable `a`
|
2024-03-26 00:23:26 -05:00
|
|
|
--> $DIR/mut-ref-mut-2021.rs:9:5
|
2024-03-23 20:04:45 -05:00
|
|
|
|
|
|
|
|
LL | let Foo(a) = Foo(0);
|
2024-01-05 23:13:18 -06:00
|
|
|
| - first assignment to `a`
|
2024-03-23 20:04:45 -05:00
|
|
|
LL | a = 42;
|
|
|
|
| ^^^^^^ cannot assign twice to immutable variable
|
2024-01-05 23:13:18 -06:00
|
|
|
|
|
|
|
|
help: consider making this binding mutable
|
|
|
|
|
|
|
|
|
LL | let Foo(mut a) = Foo(0);
|
2024-07-03 16:01:29 -05:00
|
|
|
| +++
|
2024-01-05 23:13:18 -06:00
|
|
|
help: to modify the original value, take a borrow instead
|
|
|
|
|
|
|
|
|
LL | let Foo(ref mut a) = Foo(0);
|
2024-07-03 16:01:29 -05:00
|
|
|
| +++++++
|
2024-03-23 20:04:45 -05:00
|
|
|
|
|
|
|
error[E0384]: cannot assign twice to immutable variable `a`
|
2024-03-26 00:23:26 -05:00
|
|
|
--> $DIR/mut-ref-mut-2021.rs:15:5
|
2024-03-23 20:04:45 -05:00
|
|
|
|
|
|
|
|
LL | let Foo(ref a) = Foo(0);
|
|
|
|
| ----- first assignment to `a`
|
|
|
|
LL | a = &42;
|
|
|
|
| ^^^^^^^ cannot assign twice to immutable variable
|
|
|
|
|
|
|
|
error[E0384]: cannot assign twice to immutable variable `a`
|
2024-03-26 00:23:26 -05:00
|
|
|
--> $DIR/mut-ref-mut-2021.rs:21:5
|
2024-03-23 20:04:45 -05:00
|
|
|
|
|
|
|
|
LL | let Foo(ref mut a) = Foo(0);
|
|
|
|
| --------- first assignment to `a`
|
|
|
|
LL | a = &mut 42;
|
|
|
|
| ^^^^^^^^^^^ cannot assign twice to immutable variable
|
|
|
|
|
|
|
|
error[E0384]: cannot assign twice to immutable variable `a`
|
2024-03-26 00:23:26 -05:00
|
|
|
--> $DIR/mut-ref-mut-2021.rs:27:5
|
2024-03-23 20:04:45 -05:00
|
|
|
|
|
|
|
|
LL | let Foo(a) = &Foo(0);
|
|
|
|
| - first assignment to `a`
|
|
|
|
LL | a = &42;
|
|
|
|
| ^^^^^^^ cannot assign twice to immutable variable
|
|
|
|
|
|
|
|
error[E0384]: cannot assign twice to immutable variable `a`
|
2024-03-26 00:23:26 -05:00
|
|
|
--> $DIR/mut-ref-mut-2021.rs:33:5
|
2024-03-23 20:04:45 -05:00
|
|
|
|
|
|
|
|
LL | let Foo(ref a) = &Foo(0);
|
|
|
|
| ----- first assignment to `a`
|
|
|
|
LL | a = &42;
|
|
|
|
| ^^^^^^^ cannot assign twice to immutable variable
|
|
|
|
|
|
|
|
error[E0384]: cannot assign twice to immutable variable `a`
|
2024-03-26 00:23:26 -05:00
|
|
|
--> $DIR/mut-ref-mut-2021.rs:39:5
|
2024-03-23 20:04:45 -05:00
|
|
|
|
|
|
|
|
LL | let Foo(a) = &mut Foo(0);
|
|
|
|
| - first assignment to `a`
|
|
|
|
LL | a = &mut 42;
|
|
|
|
| ^^^^^^^^^^^ cannot assign twice to immutable variable
|
|
|
|
|
|
|
|
error[E0384]: cannot assign twice to immutable variable `a`
|
2024-03-26 00:23:26 -05:00
|
|
|
--> $DIR/mut-ref-mut-2021.rs:45:5
|
2024-03-23 20:04:45 -05:00
|
|
|
|
|
|
|
|
LL | let Foo(ref a) = &mut Foo(0);
|
|
|
|
| ----- first assignment to `a`
|
|
|
|
LL | a = &42;
|
|
|
|
| ^^^^^^^ cannot assign twice to immutable variable
|
|
|
|
|
|
|
|
error[E0384]: cannot assign twice to immutable variable `a`
|
2024-03-26 00:23:26 -05:00
|
|
|
--> $DIR/mut-ref-mut-2021.rs:51:5
|
2024-03-23 20:04:45 -05:00
|
|
|
|
|
|
|
|
LL | let Foo(ref mut a) = &mut Foo(0);
|
|
|
|
| --------- first assignment to `a`
|
|
|
|
LL | a = &mut 42;
|
|
|
|
| ^^^^^^^^^^^ cannot assign twice to immutable variable
|
|
|
|
|
|
|
|
error: aborting due to 8 previous errors
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0384`.
|