rust/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr

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

320 lines
12 KiB
Plaintext
Raw Normal View History

error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:26:9
2019-12-14 17:32:20 -06:00
|
LL | let ref mut a @ ref mut b = U;
2023-02-27 11:39:02 -06:00
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
2023-01-17 06:48:43 -06:00
| value is mutably borrowed by `a` here
2019-12-14 17:32:20 -06:00
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:29:9
2019-12-14 17:32:20 -06:00
|
LL | let ref mut a @ ref mut b = U;
2023-02-27 11:39:02 -06:00
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
2023-01-17 06:48:43 -06:00
| value is mutably borrowed by `a` here
2019-12-14 17:32:20 -06:00
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:33:9
2019-12-14 17:32:20 -06:00
|
LL | let ref mut a @ ref mut b = U;
2023-02-27 11:39:02 -06:00
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
2023-01-17 06:48:43 -06:00
| value is mutably borrowed by `a` here
2019-12-14 17:32:20 -06:00
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:36:9
2019-12-14 17:32:20 -06:00
|
LL | let ref mut a @ ref mut b = U;
2023-02-27 11:39:02 -06:00
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
2023-01-17 06:48:43 -06:00
| value is mutably borrowed by `a` here
2019-12-14 17:32:20 -06:00
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:39:9
2019-12-14 17:32:20 -06:00
|
LL | let ref mut a @ ref mut b = U;
2023-02-27 11:39:02 -06:00
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
2023-01-17 06:48:43 -06:00
| value is mutably borrowed by `a` here
2019-12-14 17:32:20 -06:00
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:44:9
2019-12-14 17:32:20 -06:00
|
2023-02-27 11:39:02 -06:00
LL | let ref mut a @ (
| ^^^^^^^^^ value is mutably borrowed by `a` here
LL |
LL | ref mut b,
| --------- value is mutably borrowed by `b` here
LL | [
LL | ref mut c,
| --------- value is mutably borrowed by `c` here
LL | ref mut d,
| --------- value is mutably borrowed by `d` here
LL | ref e,
| ----- value is borrowed by `e` here
2019-12-14 17:32:20 -06:00
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:54:9
|
2023-02-27 11:39:02 -06:00
LL | let ref mut a @ (
| ^^^^^^^^^ value is mutably borrowed by `a` here
LL |
LL | ref mut b,
| --------- value is mutably borrowed by `b` here
LL | [
LL | ref mut c,
| --------- value is mutably borrowed by `c` here
LL | ref mut d,
| --------- value is mutably borrowed by `d` here
LL | ref e,
| ----- value is borrowed by `e` here
error: borrow of moved value
--> $DIR/borrowck-pat-ref-mut-twice.rs:64:9
|
LL | let a @ (ref mut b, ref mut c) = (U, U);
2023-02-27 11:39:02 -06:00
| ^ --------- --------- value borrowed here after move
| | |
| | value borrowed here after move
| value moved into `a` here
| move occurs because `a` has type `(U, U)` which does not implement the `Copy` trait
|
help: borrow this binding in the pattern to avoid moving the value
|
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
| +++
error: borrow of moved value
--> $DIR/borrowck-pat-ref-mut-twice.rs:67:9
|
LL | let a @ (b, [c, d]) = &mut val; // Same as ^--
2023-02-27 11:39:02 -06:00
| ^ - - - value borrowed here after move
| | | |
| | | value borrowed here after move
| | value borrowed here after move
| value moved into `a` here
| move occurs because `a` has type `&mut (U, [U; 2])` which does not implement the `Copy` trait
|
help: borrow this binding in the pattern to avoid moving the value
|
LL | let ref a @ (b, [c, d]) = &mut val; // Same as ^--
| +++
error: borrow of moved value
--> $DIR/borrowck-pat-ref-mut-twice.rs:70:9
|
LL | let a @ &mut ref mut b = &mut U;
2023-02-27 11:39:02 -06:00
| ^ --------- value borrowed here after move
| |
| value moved into `a` here
| move occurs because `a` has type `&mut U` which does not implement the `Copy` trait
|
help: borrow this binding in the pattern to avoid moving the value
|
LL | let ref a @ &mut ref mut b = &mut U;
| +++
error: borrow of moved value
--> $DIR/borrowck-pat-ref-mut-twice.rs:72:9
|
LL | let a @ &mut (ref mut b, ref mut c) = &mut (U, U);
2023-02-27 11:39:02 -06:00
| ^ --------- --------- value borrowed here after move
| | |
| | value borrowed here after move
| value moved into `a` here
| move occurs because `a` has type `&mut (U, U)` which does not implement the `Copy` trait
|
help: borrow this binding in the pattern to avoid moving the value
|
LL | let ref a @ &mut (ref mut b, ref mut c) = &mut (U, U);
| +++
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:76:9
2019-12-14 17:32:20 -06:00
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
2023-02-27 11:39:02 -06:00
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
2023-01-17 06:48:43 -06:00
| value is mutably borrowed by `a` here
2019-12-14 17:32:20 -06:00
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:76:37
2019-12-14 17:32:20 -06:00
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
2023-02-27 11:39:02 -06:00
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
2023-01-17 06:48:43 -06:00
| value is mutably borrowed by `a` here
2019-12-14 17:32:20 -06:00
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:82:9
2019-12-14 17:32:20 -06:00
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
2023-02-27 11:39:02 -06:00
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
2023-01-17 06:48:43 -06:00
| value is mutably borrowed by `a` here
2019-12-14 17:32:20 -06:00
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:82:37
2019-12-14 17:32:20 -06:00
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
2023-02-27 11:39:02 -06:00
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
2023-01-17 06:48:43 -06:00
| value is mutably borrowed by `a` here
2019-12-14 17:32:20 -06:00
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:89:9
2019-12-14 17:32:20 -06:00
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
2023-02-27 11:39:02 -06:00
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
2023-01-17 06:48:43 -06:00
| value is mutably borrowed by `a` here
2019-12-14 17:32:20 -06:00
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:89:37
2019-12-14 17:32:20 -06:00
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
2023-02-27 11:39:02 -06:00
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
2023-01-17 06:48:43 -06:00
| value is mutably borrowed by `a` here
2019-12-14 17:32:20 -06:00
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:101:9
2019-12-14 17:32:20 -06:00
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
2023-02-27 11:39:02 -06:00
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
2023-01-17 06:48:43 -06:00
| value is mutably borrowed by `a` here
2019-12-14 17:32:20 -06:00
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:101:37
2019-12-14 17:32:20 -06:00
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
2023-02-27 11:39:02 -06:00
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
2023-01-17 06:48:43 -06:00
| value is mutably borrowed by `a` here
2019-12-14 17:32:20 -06:00
2020-03-25 05:17:06 -05:00
error[E0499]: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:29:9
|
LL | let ref mut a @ ref mut b = U;
| ^^^^^^^^^ --------- first mutable borrow occurs here
| |
| second mutable borrow occurs here
2019-12-14 17:32:20 -06:00
...
LL | drop(b);
| - first borrow later used here
2020-03-25 05:17:06 -05:00
error[E0499]: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:39:9
|
LL | let ref mut a @ ref mut b = U;
| ^^^^^^^^^ --------- first mutable borrow occurs here
| |
| second mutable borrow occurs here
2019-12-14 17:32:20 -06:00
...
LL | *b = U;
| ------ first borrow later used here
2020-03-25 05:17:06 -05:00
error[E0499]: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:89:24
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| --------- ^^^^^^^^^ second mutable borrow occurs here
| |
2020-11-03 00:45:41 -06:00
| first mutable borrow occurs here
...
2020-11-03 00:45:41 -06:00
LL | *a = Err(U);
| ----------- first borrow later used here
2020-03-25 05:17:06 -05:00
error[E0499]: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:89:53
2020-11-03 00:45:41 -06:00
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| --------- ^^^^^^^^^ second mutable borrow occurs here
| |
2020-11-03 00:45:41 -06:00
| first mutable borrow occurs here
...
LL | *a = Err(U);
| ----------- first borrow later used here
error[E0499]: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:101:24
2020-11-03 00:45:41 -06:00
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| --------- ^^^^^^^^^ second mutable borrow occurs here
| |
2020-11-03 00:45:41 -06:00
| first mutable borrow occurs here
...
LL | drop(a);
| - first borrow later used here
error[E0499]: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:101:53
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| --------- ^^^^^^^^^ second mutable borrow occurs here
| |
2020-11-03 00:45:41 -06:00
| first mutable borrow occurs here
...
2020-11-03 00:45:41 -06:00
LL | drop(a);
| - first borrow later used here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:8:11
|
LL | fn f1(ref mut a @ ref mut b: U) {}
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:10:11
|
LL | fn f2(ref mut a @ ref mut b: U) {}
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:13:9
|
LL | ref mut a @ [
| ^^^^^^^^^ value is mutably borrowed by `a` here
LL |
LL | [ref b @ .., _],
| ----- value is borrowed by `b` here
LL | [_, ref mut mid @ ..],
| ----------- value is mutably borrowed by `mid` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:21:22
|
LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {}
| ^^^^^^^^^ --------- - value is moved into `c` here
| | |
| | value is mutably borrowed by `b` here
| value is mutably borrowed by `a` here
error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-ref-mut-twice.rs:21:34
|
LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {}
| ^^^^^^^^^ - value is moved into `c` here
| |
| value is mutably borrowed by `b` here
error[E0382]: borrow of moved value
--> $DIR/borrowck-pat-ref-mut-twice.rs:21:34
|
LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {}
2022-09-08 09:44:45 -05:00
| --------- ^^^^^^^^^ - value moved here
| | |
| | value borrowed here after move
| move occurs because value has type `U`, which does not implement the `Copy` trait
2020-11-03 00:45:41 -06:00
error: aborting due to 31 previous errors
Some errors have detailed explanations: E0382, E0499.
For more information about an error, try `rustc --explain E0382`.