2020-02-02 10:58:15 -06:00
|
|
|
error: cannot move out of value because it is borrowed
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-at-and-box.rs:31:9
|
2019-11-11 04:39:52 -06:00
|
|
|
|
|
|
|
|
LL | let ref a @ box b = Box::new(NC);
|
2023-02-27 11:39:02 -06:00
|
|
|
| ^^^^^ - value is moved into `b` here
|
|
|
|
| |
|
2023-01-17 06:48:43 -06:00
|
|
|
| value is borrowed by `a` here
|
2019-11-11 04:39:52 -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-at-and-box.rs:34:9
|
2019-12-14 17:50:44 -06:00
|
|
|
|
|
|
|
|
LL | let ref a @ box ref mut b = Box::new(nc());
|
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 mutable because it is also borrowed as immutable
|
2021-05-17 23:14:06 -05:00
|
|
|
--> $DIR/borrowck-pat-at-and-box.rs:36:9
|
2019-12-14 17:32:20 -06:00
|
|
|
|
|
|
|
|
LL | let ref a @ box ref mut b = Box::new(NC);
|
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-at-and-box.rs:38:9
|
2019-12-14 17:32:20 -06:00
|
|
|
|
|
|
|
|
LL | let ref a @ box ref mut b = Box::new(NC);
|
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-at-and-box.rs:42:9
|
2019-12-14 17:32:20 -06:00
|
|
|
|
|
|
|
|
LL | let ref a @ box ref mut b = Box::new(NC);
|
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-at-and-box.rs:48:9
|
2019-12-14 17:32:20 -06:00
|
|
|
|
|
|
|
|
LL | let ref mut a @ box ref b = Box::new(NC);
|
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-at-and-box.rs:62:9
|
2019-12-14 20:50:55 -06:00
|
|
|
|
|
|
|
|
LL | ref mut a @ box 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 20:50:55 -06:00
|
|
|
|
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-at-and-box.rs:31:9
|
2019-11-11 04:39:52 -06:00
|
|
|
|
|
2020-11-01 12:35:55 -06:00
|
|
|
LL | let ref a @ box b = Box::new(NC);
|
2022-09-03 17:55:53 -05:00
|
|
|
| ^^^^^ - value moved here
|
|
|
|
| |
|
2020-11-01 12:35:55 -06:00
|
|
|
| value borrowed here after move
|
2019-11-11 04:39:52 -06:00
|
|
|
|
|
2020-11-01 12:35:55 -06:00
|
|
|
= note: move occurs because value has type `NC`, which does not implement the `Copy` trait
|
2022-11-02 23:22:24 -05:00
|
|
|
help: borrow this binding in the pattern to avoid moving the value
|
|
|
|
|
|
|
|
|
LL | let ref a @ box ref b = Box::new(NC);
|
|
|
|
| +++
|
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-at-and-box.rs:38:9
|
2019-12-14 20:50:55 -06:00
|
|
|
|
|
2020-11-01 12:35:55 -06:00
|
|
|
LL | let ref a @ box ref mut b = Box::new(NC);
|
2022-09-03 17:55:53 -05:00
|
|
|
| ^^^^^ --------- mutable borrow occurs here
|
|
|
|
| |
|
2020-11-01 12:35:55 -06:00
|
|
|
| immutable borrow occurs here
|
|
|
|
...
|
|
|
|
LL | *b = NC;
|
|
|
|
| ------- mutable borrow later used here
|
2019-12-14 20:50:55 -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-at-and-box.rs:42:9
|
2019-11-11 04:39:52 -06:00
|
|
|
|
|
|
|
|
LL | let ref a @ box ref mut b = Box::new(NC);
|
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 = NC;
|
|
|
|
| ------- 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-at-and-box.rs:48:9
|
2019-11-11 04:39:52 -06:00
|
|
|
|
|
|
|
|
LL | let ref mut a @ box ref b = Box::new(NC);
|
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-01 12:35:55 -06:00
|
|
|
LL | drop(b);
|
|
|
|
| - immutable 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-at-and-box.rs:62:9
|
2019-12-14 20:50:55 -06:00
|
|
|
|
|
|
|
|
LL | ref mut a @ box ref b => {
|
2022-09-03 17:55:53 -05:00
|
|
|
| ^^^^^^^^^ ----- immutable borrow occurs here
|
|
|
|
| |
|
2019-12-14 20:50:55 -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 20:50:55 -06:00
|
|
|
|
2023-02-16 04:06:59 -06:00
|
|
|
error: cannot borrow value as immutable because it is also borrowed as mutable
|
|
|
|
--> $DIR/borrowck-pat-at-and-box.rs:54:11
|
|
|
|
|
|
|
|
|
LL | fn f5(ref mut a @ box ref b: Box<NC>) {
|
|
|
|
| ^^^^^^^^^ ----- value is borrowed by `b` here
|
|
|
|
| |
|
|
|
|
| value is mutably borrowed by `a` here
|
|
|
|
|
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-at-and-box.rs:54:11
|
2019-12-14 20:50:55 -06:00
|
|
|
|
|
|
|
|
LL | fn f5(ref mut a @ box ref b: Box<NC>) {
|
2022-09-03 17:55:53 -05:00
|
|
|
| ^^^^^^^^^ ----- immutable borrow occurs here
|
|
|
|
| |
|
2019-12-14 20:50:55 -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 20:50:55 -06:00
|
|
|
|
2020-11-01 12:35:55 -06:00
|
|
|
error: aborting due to 14 previous errors
|
2019-11-11 04:39:52 -06:00
|
|
|
|
2020-01-18 19:47:01 -06:00
|
|
|
Some errors have detailed explanations: E0382, E0502.
|
|
|
|
For more information about an error, try `rustc --explain E0382`.
|