2020-02-02 10:58:15 -06:00
|
|
|
error: cannot borrow value as immutable because it is also borrowed as mutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:8:9
|
2019-12-14 17:32:20 -06:00
|
|
|
|
|
|
|
|
LL | ref mut z @ &mut Some(ref a) => {
|
2023-02-27 11:39:02 -06:00
|
|
|
| ^^^^^^^^^ ----- value is borrowed by `a` here
|
|
|
|
| |
|
2023-01-17 06:48:43 -06:00
|
|
|
| value is mutably borrowed by `z` here
|
2019-12-14 17:32:20 -06:00
|
|
|
|
2020-02-02 10:58:15 -06:00
|
|
|
error: cannot borrow value as mutable more than once at a time
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:33:9
|
2019-12-14 20:50:55 -06:00
|
|
|
|
|
|
|
|
LL | let ref mut a @ (ref b @ ref mut c) = u(); // sub-in-sub
|
2023-02-27 11:39:02 -06:00
|
|
|
| ^^^^^^^^^ ----- --------- value is mutably borrowed by `c` here
|
|
|
|
| | |
|
2023-01-17 06:48:43 -06:00
|
|
|
| | value is borrowed by `b` here
|
|
|
|
| value is mutably borrowed by `a` here
|
2019-12-14 20:50:55 -06:00
|
|
|
|
2020-02-02 10:58:15 -06:00
|
|
|
error: cannot borrow value as mutable because it is also borrowed as immutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:33:22
|
2019-12-14 20:50:55 -06:00
|
|
|
|
|
|
|
|
LL | let ref mut a @ (ref b @ ref mut c) = u(); // sub-in-sub
|
2023-02-27 11:39:02 -06:00
|
|
|
| ^^^^^ --------- value is mutably borrowed by `c` here
|
|
|
|
| |
|
2023-01-17 06:48:43 -06:00
|
|
|
| value is borrowed by `b` here
|
2019-12-14 20:50:55 -06:00
|
|
|
|
2020-02-02 10:58:15 -06:00
|
|
|
error: cannot borrow value as mutable because it is also borrowed as immutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:37:9
|
2019-12-14 17:32:20 -06:00
|
|
|
|
|
|
|
|
LL | let ref 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 borrowed by `a` here
|
2019-12-14 17:32:20 -06:00
|
|
|
|
2020-02-02 10:58:15 -06:00
|
|
|
error: cannot borrow value as immutable because it is also borrowed as mutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:39:9
|
2019-12-14 17:32:20 -06:00
|
|
|
|
|
|
|
|
LL | let ref mut a @ ref b = U;
|
2023-02-27 11:39:02 -06:00
|
|
|
| ^^^^^^^^^ ----- value is 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-02-02 10:58:15 -06:00
|
|
|
error: cannot borrow value as mutable because it is also borrowed as immutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:41:9
|
2019-12-14 17:32:20 -06:00
|
|
|
|
|
|
|
|
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
|
2023-02-27 11:39:02 -06:00
|
|
|
| ^^^^^ --------- --------- value is mutably borrowed by `c` here
|
|
|
|
| | |
|
2023-01-17 06:48:43 -06:00
|
|
|
| | value is mutably borrowed by `b` here
|
|
|
|
| value is borrowed by `a` here
|
2019-12-14 17:32:20 -06:00
|
|
|
|
2020-02-02 10:58:15 -06:00
|
|
|
error: cannot borrow value as immutable because it is also borrowed as mutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:43:9
|
2019-12-14 17:32:20 -06:00
|
|
|
|
|
|
|
|
LL | let ref mut a @ (ref b, ref c) = (U, U);
|
2023-02-27 11:39:02 -06:00
|
|
|
| ^^^^^^^^^ ----- ----- value is borrowed by `c` here
|
|
|
|
| | |
|
2023-01-17 06:48:43 -06:00
|
|
|
| | value is borrowed by `b` here
|
|
|
|
| value is mutably borrowed by `a` here
|
2019-12-14 17:32:20 -06:00
|
|
|
|
2020-02-02 10:58:15 -06:00
|
|
|
error: cannot borrow value as immutable because it is also borrowed as mutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:46:9
|
2019-12-14 17:50:44 -06:00
|
|
|
|
|
|
|
|
LL | let ref mut a @ ref b = u();
|
2023-02-27 11:39:02 -06:00
|
|
|
| ^^^^^^^^^ ----- value is borrowed by `b` here
|
|
|
|
| |
|
2023-01-17 06:48:43 -06:00
|
|
|
| value is mutably borrowed by `a` here
|
2019-12-14 17:50:44 -06:00
|
|
|
|
2020-02-02 10:58:15 -06:00
|
|
|
error: cannot borrow value as mutable because it is also borrowed as immutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:51:9
|
2019-12-14 17:50:44 -06:00
|
|
|
|
|
|
|
|
LL | let ref 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 borrowed by `a` here
|
2019-12-14 17:50:44 -06:00
|
|
|
|
2020-02-02 10:58:15 -06:00
|
|
|
error: cannot borrow value as immutable because it is also borrowed as mutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:57:9
|
2019-12-14 17:32:20 -06:00
|
|
|
|
|
|
|
|
LL | let ref mut a @ ref b = U;
|
2023-02-27 11:39:02 -06:00
|
|
|
| ^^^^^^^^^ ----- value is 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-02-02 10:58:15 -06:00
|
|
|
error: cannot borrow value as mutable because it is also borrowed as immutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:61:9
|
2019-12-14 17:32:20 -06:00
|
|
|
|
|
|
|
|
LL | let ref 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 borrowed by `a` here
|
2019-12-14 17:32:20 -06:00
|
|
|
|
2020-02-02 10:58:15 -06:00
|
|
|
error: cannot borrow value as immutable because it is also borrowed as mutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:67:9
|
2019-12-14 17:32:20 -06:00
|
|
|
|
|
|
|
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) => {
|
2023-02-27 11:39:02 -06:00
|
|
|
| ^^^^^^^^^ ----- value is 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-02-02 10:58:15 -06:00
|
|
|
error: cannot borrow value as immutable because it is also borrowed as mutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:67:33
|
2019-12-14 17:32:20 -06:00
|
|
|
|
|
|
|
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) => {
|
2023-02-27 11:39:02 -06:00
|
|
|
| ^^^^^^^^^ ----- value is 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-02-02 10:58:15 -06:00
|
|
|
error: cannot borrow value as mutable because it is also borrowed as immutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:76:9
|
2019-12-14 17:32:20 -06:00
|
|
|
|
|
|
|
|
LL | ref a @ Ok(ref mut b) | ref 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 borrowed by `a` here
|
2019-12-14 17:32:20 -06:00
|
|
|
|
2020-02-02 10:58:15 -06:00
|
|
|
error: cannot borrow value as mutable because it is also borrowed as immutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:76:33
|
2019-12-14 17:32:20 -06:00
|
|
|
|
|
|
|
|
LL | ref a @ Ok(ref mut b) | ref 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 borrowed by `a` here
|
2019-12-14 17:32:20 -06:00
|
|
|
|
2020-02-02 10:58:15 -06:00
|
|
|
error: cannot borrow value as mutable because it is also borrowed as immutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:87:9
|
2019-12-14 17:32:20 -06:00
|
|
|
|
|
|
|
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {}
|
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 borrowed by `a` here
|
2019-12-14 17:32:20 -06:00
|
|
|
|
2020-02-02 10:58:15 -06:00
|
|
|
error: cannot borrow value as mutable because it is also borrowed as immutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:87:33
|
2019-12-14 17:32:20 -06:00
|
|
|
|
|
|
|
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {}
|
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 borrowed by `a` here
|
2019-12-14 17:32:20 -06:00
|
|
|
|
2020-02-02 10:58:15 -06:00
|
|
|
error: cannot borrow value as immutable because it is also borrowed as mutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:94:9
|
2019-12-14 17:32:20 -06:00
|
|
|
|
|
|
|
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {}
|
2023-02-27 11:39:02 -06:00
|
|
|
| ^^^^^^^^^ ----- value is 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-02-02 10:58:15 -06:00
|
|
|
error: cannot borrow value as immutable because it is also borrowed as mutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:94:33
|
2019-12-14 17:32:20 -06:00
|
|
|
|
|
|
|
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {}
|
2023-02-27 11:39:02 -06:00
|
|
|
| ^^^^^^^^^ ----- value is 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-02-02 10:58:15 -06:00
|
|
|
error: cannot borrow value as mutable because it is also borrowed as immutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:101:9
|
2019-12-14 17:32:20 -06:00
|
|
|
|
|
|
|
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {}
|
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 borrowed by `a` here
|
2019-12-14 17:32:20 -06:00
|
|
|
|
2020-02-02 10:58:15 -06:00
|
|
|
error: cannot borrow value as mutable because it is also borrowed as immutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:101:33
|
2019-12-14 17:32:20 -06:00
|
|
|
|
|
|
|
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {}
|
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 borrowed by `a` here
|
2019-12-14 17:32:20 -06:00
|
|
|
|
2020-02-02 10:58:15 -06:00
|
|
|
error: cannot borrow value as immutable because it is also borrowed as mutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:109:9
|
2019-12-14 17:32:20 -06:00
|
|
|
|
|
|
|
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {}
|
2023-02-27 11:39:02 -06:00
|
|
|
| ^^^^^^^^^ ----- value is 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-02-02 10:58:15 -06:00
|
|
|
error: cannot borrow value as immutable because it is also borrowed as mutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:109:33
|
2019-12-14 17:32:20 -06:00
|
|
|
|
|
|
|
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {}
|
2023-02-27 11:39:02 -06:00
|
|
|
| ^^^^^^^^^ ----- value is 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-02-02 10:58:15 -06:00
|
|
|
error: cannot borrow value as mutable because it is also borrowed as immutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:117:9
|
2019-12-14 17:32:20 -06:00
|
|
|
|
|
|
|
|
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
|
2023-02-27 11:39:02 -06:00
|
|
|
| ^^^^^ --------- --------- value is mutably borrowed by `c` here
|
|
|
|
| | |
|
2023-01-17 06:48:43 -06:00
|
|
|
| | value is mutably borrowed by `b` here
|
|
|
|
| value is borrowed by `a` here
|
2019-12-14 17:32:20 -06:00
|
|
|
|
2020-02-02 10:58:15 -06:00
|
|
|
error: cannot borrow value as mutable because it is also borrowed as immutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:123:9
|
2019-12-14 17:32:20 -06:00
|
|
|
|
|
|
|
|
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
|
2023-02-27 11:39:02 -06:00
|
|
|
| ^^^^^ --------- --------- value is mutably borrowed by `c` here
|
|
|
|
| | |
|
2023-01-17 06:48:43 -06:00
|
|
|
| | value is mutably borrowed by `b` here
|
|
|
|
| value is borrowed by `a` here
|
2019-12-14 17:32:20 -06:00
|
|
|
|
2020-02-02 10:58:15 -06:00
|
|
|
error: cannot borrow value as mutable because it is also borrowed as immutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:129:9
|
2019-12-14 17:32:20 -06:00
|
|
|
|
|
|
|
|
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
|
2023-02-27 11:39:02 -06:00
|
|
|
| ^^^^^ --------- --------- value is mutably borrowed by `c` here
|
|
|
|
| | |
|
2023-01-17 06:48:43 -06:00
|
|
|
| | value is mutably borrowed by `b` here
|
|
|
|
| value is borrowed by `a` here
|
2019-12-14 17:32:20 -06:00
|
|
|
|
2020-02-02 10:58:15 -06:00
|
|
|
error: cannot borrow value as immutable because it is also borrowed as mutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:134:9
|
2019-12-14 17:32:20 -06:00
|
|
|
|
|
|
|
|
LL | let ref mut a @ (ref b, ref c) = (U, U);
|
2023-02-27 11:39:02 -06:00
|
|
|
| ^^^^^^^^^ ----- ----- value is borrowed by `c` here
|
|
|
|
| | |
|
2023-01-17 06:48:43 -06:00
|
|
|
| | value is borrowed by `b` here
|
|
|
|
| value is mutably borrowed by `a` here
|
2019-12-14 17:32:20 -06:00
|
|
|
|
2020-11-03 00:45:41 -06:00
|
|
|
error[E0502]: cannot borrow value as immutable because it is also borrowed as mutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:8:31
|
2019-11-11 04:39:52 -06:00
|
|
|
|
|
|
|
|
LL | ref mut z @ &mut Some(ref a) => {
|
2022-09-03 17:55:53 -05:00
|
|
|
| --------- ^^^^^ immutable borrow occurs here
|
|
|
|
| |
|
2019-11-11 04:39:52 -06:00
|
|
|
| mutable borrow occurs here
|
2019-12-14 17:32:20 -06:00
|
|
|
...
|
2020-11-03 00:45:41 -06:00
|
|
|
LL | **z = None;
|
|
|
|
| ---------- mutable borrow later used here
|
2019-11-11 04:39:52 -06:00
|
|
|
|
2020-11-01 12:35:55 -06:00
|
|
|
error[E0502]: cannot borrow value as mutable because it is also borrowed as immutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:46:9
|
2019-12-14 17:50:44 -06:00
|
|
|
|
|
|
|
|
LL | let ref mut a @ ref b = u();
|
2022-09-03 17:55:53 -05:00
|
|
|
| ^^^^^^^^^ ----- immutable borrow occurs here
|
|
|
|
| |
|
2019-12-14 17:50:44 -06:00
|
|
|
| mutable borrow occurs here
|
|
|
|
...
|
2020-11-01 12:35:55 -06:00
|
|
|
LL | drop(b);
|
|
|
|
| - immutable borrow later used here
|
2019-12-14 17:50:44 -06:00
|
|
|
|
2020-11-01 12:35:55 -06:00
|
|
|
error[E0502]: cannot borrow value as immutable because it is also borrowed as mutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:51:9
|
2019-12-14 17:50:44 -06:00
|
|
|
|
|
|
|
|
LL | let ref a @ ref mut b = u();
|
2022-09-03 17:55:53 -05:00
|
|
|
| ^^^^^ --------- mutable borrow occurs here
|
|
|
|
| |
|
2019-12-14 17:50:44 -06:00
|
|
|
| immutable borrow occurs here
|
|
|
|
...
|
2020-11-01 12:35:55 -06:00
|
|
|
LL | *b = u();
|
|
|
|
| -------- mutable borrow later used here
|
2019-12-14 17:50:44 -06:00
|
|
|
|
2020-11-03 00:45:41 -06:00
|
|
|
error[E0502]: cannot borrow value as mutable because it is also borrowed as immutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:76:20
|
2019-11-11 04:39:52 -06:00
|
|
|
|
|
|
|
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => {
|
2022-09-03 17:55:53 -05:00
|
|
|
| ----- ^^^^^^^^^ mutable borrow occurs here
|
|
|
|
| |
|
2019-11-11 04:39:52 -06:00
|
|
|
| immutable borrow occurs here
|
|
|
|
...
|
2020-11-03 00:45:41 -06:00
|
|
|
LL | drop(a);
|
|
|
|
| - immutable borrow later used here
|
2019-11-11 04:39:52 -06:00
|
|
|
|
2020-11-03 00:45:41 -06:00
|
|
|
error[E0502]: cannot borrow value as mutable because it is also borrowed as immutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:76:45
|
2019-11-11 04:39:52 -06:00
|
|
|
|
|
|
|
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => {
|
2022-09-03 17:55:53 -05:00
|
|
|
| ----- ^^^^^^^^^ mutable borrow occurs here
|
|
|
|
| |
|
2019-11-11 04:39:52 -06:00
|
|
|
| immutable borrow occurs here
|
|
|
|
...
|
2020-11-03 00:45:41 -06:00
|
|
|
LL | drop(a);
|
|
|
|
| - immutable borrow later used here
|
2019-11-11 04:39:52 -06:00
|
|
|
|
|
|
|
error[E0594]: cannot assign to `*b`, as it is immutable for the pattern guard
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:87:61
|
2019-11-11 04:39:52 -06:00
|
|
|
|
|
|
|
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {}
|
|
|
|
| ^^^^^^ cannot assign
|
|
|
|
|
|
|
|
|
= note: variables bound in patterns are immutable until the end of the pattern guard
|
|
|
|
|
|
|
|
error[E0594]: cannot assign to `*a`, as it is immutable for the pattern guard
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:94:61
|
2019-11-11 04:39:52 -06:00
|
|
|
|
|
|
|
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {}
|
|
|
|
| ^^^^^^^^^^^ cannot assign
|
|
|
|
|
|
|
|
|
= note: variables bound in patterns are immutable until the end of the pattern guard
|
|
|
|
|
|
|
|
error[E0507]: cannot move out of `b` in pattern guard
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:101:66
|
2019-11-11 04:39:52 -06:00
|
|
|
|
|
|
|
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {}
|
2020-09-02 02:40:56 -05:00
|
|
|
| ^ move occurs because `b` has type `&mut U`, which does not implement the `Copy` trait
|
2019-11-11 04:39:52 -06:00
|
|
|
|
|
|
|
|
= note: variables bound in patterns cannot be moved from until after the end of the pattern guard
|
|
|
|
|
2020-01-08 11:02:10 -06:00
|
|
|
error[E0507]: cannot move out of `b` in pattern guard
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:101:66
|
2020-01-08 11:02:10 -06:00
|
|
|
|
|
|
|
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {}
|
2020-09-02 02:40:56 -05:00
|
|
|
| ^ move occurs because `b` has type `&mut U`, which does not implement the `Copy` trait
|
2020-01-08 11:02:10 -06:00
|
|
|
|
|
|
|
|
= note: variables bound in patterns cannot be moved from until after the end of the pattern guard
|
|
|
|
|
|
|
|
error[E0507]: cannot move out of `a` in pattern guard
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:109:66
|
2020-01-08 11:02:10 -06:00
|
|
|
|
|
|
|
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {}
|
2021-01-28 10:01:36 -06:00
|
|
|
| ^ move occurs because `a` has type `&mut Result<U, U>`, which does not implement the `Copy` trait
|
2020-01-08 11:02:10 -06:00
|
|
|
|
|
|
|
|
= note: variables bound in patterns cannot be moved from until after the end of the pattern guard
|
|
|
|
|
2019-11-11 04:39:52 -06:00
|
|
|
error[E0507]: cannot move out of `a` in pattern guard
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:109:66
|
2019-11-11 04:39:52 -06:00
|
|
|
|
|
|
|
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {}
|
2021-01-28 10:01:36 -06:00
|
|
|
| ^ move occurs because `a` has type `&mut Result<U, U>`, which does not implement the `Copy` trait
|
2019-11-11 04:39:52 -06:00
|
|
|
|
|
|
|
|
= note: variables bound in patterns cannot be moved from until after the end of the pattern guard
|
|
|
|
|
2020-11-01 12:35:55 -06:00
|
|
|
error[E0502]: cannot borrow value as immutable because it is also borrowed as mutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:117:9
|
2019-11-11 04:39:52 -06:00
|
|
|
|
|
|
|
|
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
|
2022-09-03 17:55:53 -05:00
|
|
|
| ^^^^^ --------- mutable borrow occurs here
|
|
|
|
| |
|
2019-11-11 04:39:52 -06:00
|
|
|
| immutable borrow occurs here
|
|
|
|
...
|
2020-11-02 10:59:20 -06:00
|
|
|
LL | *b = U;
|
2020-11-01 12:35:55 -06:00
|
|
|
| ------ mutable borrow later used here
|
2019-11-11 04:39:52 -06:00
|
|
|
|
2020-11-01 12:35:55 -06:00
|
|
|
error[E0502]: cannot borrow value as immutable because it is also borrowed as mutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:123:9
|
2019-11-11 04:39:52 -06:00
|
|
|
|
|
|
|
|
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
|
2022-09-03 17:55:53 -05:00
|
|
|
| ^^^^^ --------- mutable borrow occurs here
|
|
|
|
| |
|
2019-11-11 04:39:52 -06:00
|
|
|
| immutable borrow occurs here
|
|
|
|
...
|
2020-11-01 12:35:55 -06:00
|
|
|
LL | *b = U;
|
|
|
|
| ------ mutable borrow later used here
|
2019-11-11 04:39:52 -06:00
|
|
|
|
2020-11-01 12:35:55 -06:00
|
|
|
error[E0502]: cannot borrow value as immutable because it is also borrowed as mutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:129:9
|
2019-11-11 04:39:52 -06:00
|
|
|
|
|
|
|
|
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
|
2022-09-03 17:55:53 -05:00
|
|
|
| ^^^^^ --------- mutable borrow occurs here
|
|
|
|
| |
|
2019-11-11 04:39:52 -06:00
|
|
|
| immutable borrow occurs here
|
2020-11-02 10:59:20 -06:00
|
|
|
LL |
|
|
|
|
LL | *b = U;
|
2020-11-01 12:35:55 -06:00
|
|
|
| ------ mutable borrow later used here
|
|
|
|
|
2023-02-16 04:06:59 -06:00
|
|
|
error: cannot borrow value as mutable because it is also borrowed as immutable
|
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:22:11
|
|
|
|
|
|
|
|
|
LL | fn f1(ref a @ ref mut b: U) {}
|
|
|
|
| ^^^^^ --------- value is mutably borrowed by `b` here
|
|
|
|
| |
|
|
|
|
| value is borrowed by `a` here
|
|
|
|
|
|
|
|
error: cannot borrow value as immutable because it is also borrowed as mutable
|
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:24:11
|
|
|
|
|
|
|
|
|
LL | fn f2(ref mut a @ ref b: U) {}
|
|
|
|
| ^^^^^^^^^ ----- value is borrowed by `b` here
|
|
|
|
| |
|
|
|
|
| value is mutably borrowed by `a` here
|
|
|
|
|
|
|
|
error: cannot borrow value as mutable because it is also borrowed as immutable
|
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:26:11
|
|
|
|
|
|
|
|
|
LL | fn f3(ref a @ [ref b, ref mut mid @ .., ref c]: [U; 4]) {}
|
|
|
|
| ^^^^^ ----------- value is mutably borrowed by `mid` here
|
|
|
|
| |
|
|
|
|
| value is borrowed by `a` here
|
|
|
|
|
|
|
|
error: cannot borrow value as mutable because it is also borrowed as immutable
|
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:28:22
|
|
|
|
|
|
|
|
|
LL | fn f4_also_moved(ref a @ ref mut b @ c: U) {}
|
|
|
|
| ^^^^^ --------- - value is moved into `c` here
|
|
|
|
| | |
|
|
|
|
| | value is mutably borrowed by `b` here
|
|
|
|
| value is borrowed by `a` here
|
|
|
|
|
|
|
|
error: cannot move out of value because it is borrowed
|
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:28:30
|
|
|
|
|
|
|
|
|
LL | fn f4_also_moved(ref a @ ref mut b @ c: U) {}
|
|
|
|
| ^^^^^^^^^ - value is moved into `c` here
|
|
|
|
| |
|
|
|
|
| value is mutably borrowed by `b` here
|
|
|
|
|
2020-11-01 12:35:55 -06:00
|
|
|
error[E0382]: borrow of moved value
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:28:30
|
2020-11-01 12:35:55 -06:00
|
|
|
|
|
|
|
|
LL | fn f4_also_moved(ref a @ ref mut b @ c: U) {}
|
2022-09-08 09:44:45 -05:00
|
|
|
| ----- ^^^^^^^^^ - value moved here
|
|
|
|
| | |
|
2020-11-01 12:35:55 -06:00
|
|
|
| | value borrowed here after move
|
|
|
|
| move occurs because value has type `U`, which does not implement the `Copy` trait
|
2019-11-11 04:39:52 -06:00
|
|
|
|
2020-11-03 00:45:41 -06:00
|
|
|
error: aborting due to 47 previous errors
|
2019-11-11 04:39:52 -06:00
|
|
|
|
2020-11-01 12:35:55 -06:00
|
|
|
Some errors have detailed explanations: E0382, E0502, E0507, E0594.
|
|
|
|
For more information about an error, try `rustc --explain E0382`.
|