rust/tests/ui/pattern/mut-ref-mut-2021.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

77 lines
2.4 KiB
Plaintext
Raw Normal View History

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);
| - first assignment to `a`
2024-03-23 20:04:45 -05:00
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);
| +++++++
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`.