mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
77 lines
2.4 KiB
Plaintext
77 lines
2.4 KiB
Plaintext
error[E0384]: cannot assign twice to immutable variable `a`
|
|
--> $DIR/mut-ref-mut-2021.rs:9:5
|
|
|
|
|
LL | let Foo(a) = Foo(0);
|
|
| - first assignment to `a`
|
|
LL | a = 42;
|
|
| ^^^^^^ cannot assign twice to immutable variable
|
|
|
|
|
help: consider making this binding mutable
|
|
|
|
|
LL | let Foo(mut a) = Foo(0);
|
|
| ~~~~~
|
|
help: to modify the original value, take a borrow instead
|
|
|
|
|
LL | let Foo(ref mut a) = Foo(0);
|
|
| ~~~~~~~~~
|
|
|
|
error[E0384]: cannot assign twice to immutable variable `a`
|
|
--> $DIR/mut-ref-mut-2021.rs:15:5
|
|
|
|
|
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`
|
|
--> $DIR/mut-ref-mut-2021.rs:21:5
|
|
|
|
|
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`
|
|
--> $DIR/mut-ref-mut-2021.rs:27:5
|
|
|
|
|
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`
|
|
--> $DIR/mut-ref-mut-2021.rs:33:5
|
|
|
|
|
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`
|
|
--> $DIR/mut-ref-mut-2021.rs:39:5
|
|
|
|
|
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`
|
|
--> $DIR/mut-ref-mut-2021.rs:45:5
|
|
|
|
|
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`
|
|
--> $DIR/mut-ref-mut-2021.rs:51:5
|
|
|
|
|
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`.
|