rust/src/test/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.stderr

174 lines
6.4 KiB
Plaintext
Raw Normal View History

error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-at-and-box.rs:37:9
|
LL | let ref a @ box b = Box::new(NC);
| -----^^^^^^^-
| | |
| | value moved into `b` here
| value borrowed, by `a`, here
error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/borrowck-pat-at-and-box.rs:39:9
|
LL | let ref a @ box ref mut b = Box::new(nc());
| -----^^^^^^^---------
| | |
| | mutable borrow, by `b`, occurs here
| immutable borrow, by `a`, occurs here
error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/borrowck-pat-at-and-box.rs:41:9
2019-12-14 17:32:20 -06:00
|
LL | let ref a @ box ref mut b = Box::new(NC);
| -----^^^^^^^---------
| | |
| | mutable borrow, by `b`, occurs here
| immutable borrow, by `a`, occurs here
2019-12-14 17:32:20 -06:00
error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/borrowck-pat-at-and-box.rs:43:9
2019-12-14 17:32:20 -06:00
|
LL | let ref a @ box ref mut b = Box::new(NC);
| -----^^^^^^^---------
| | |
| | mutable borrow, by `b`, occurs here
| immutable borrow, by `a`, occurs here
2019-12-14 17:32:20 -06:00
error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/borrowck-pat-at-and-box.rs:46:9
2019-12-14 17:32:20 -06:00
|
LL | let ref a @ box ref mut b = Box::new(NC);
| -----^^^^^^^---------
| | |
| | mutable borrow, by `b`, occurs here
| immutable borrow, by `a`, occurs here
2019-12-14 17:32:20 -06:00
error: cannot borrow value as immutable because it is also borrowed as mutable
--> $DIR/borrowck-pat-at-and-box.rs:52:9
2019-12-14 17:32:20 -06:00
|
LL | let ref mut a @ box ref b = Box::new(NC);
| ---------^^^^^^^-----
| | |
| | immutable borrow, by `b`, occurs here
| mutable borrow, by `a`, occurs here
2019-12-14 17:32:20 -06:00
error: cannot borrow value as immutable because it is also borrowed as mutable
--> $DIR/borrowck-pat-at-and-box.rs:66:9
|
LL | ref mut a @ box ref b => {
| ---------^^^^^^^-----
| | |
| | immutable borrow, by `b`, occurs here
| mutable borrow, by `a`, occurs here
error: cannot borrow value as immutable because it is also borrowed as mutable
--> $DIR/borrowck-pat-at-and-box.rs:58:11
|
LL | fn f5(ref mut a @ box ref b: Box<NC>) {
| ---------^^^^^^^-----
| | |
| | immutable borrow, by `b`, occurs here
| mutable borrow, by `a`, occurs here
error[E0382]: use of moved value
--> $DIR/borrowck-pat-at-and-box.rs:21:18
|
LL | let a @ box &b = Box::new(&C);
| ---------^ ------------ move occurs because value has type `std::boxed::Box<&C>`, which does not implement the `Copy` trait
| | |
| | value used here after move
| value moved here
error[E0382]: use of moved value
--> $DIR/borrowck-pat-at-and-box.rs:24:17
|
LL | let a @ box b = Box::new(C);
| --------^ ----------- move occurs because value has type `std::boxed::Box<C>`, which does not implement the `Copy` trait
| | |
| | value used here after move
| value moved here
error[E0382]: use of moved value
--> $DIR/borrowck-pat-at-and-box.rs:34:17
|
LL | match Box::new(C) {
| ----------- move occurs because value has type `std::boxed::Box<C>`, which does not implement the `Copy` trait
LL | a @ box b => {}
| --------^
| | |
| | value used here after move
| value moved here
2020-03-25 05:17:06 -05:00
error[E0502]: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/borrowck-pat-at-and-box.rs:46:21
|
LL | let ref a @ box ref mut b = Box::new(NC);
| ------------^^^^^^^^^
| | |
| | mutable borrow occurs here
| immutable borrow occurs here
...
LL | drop(a);
| - immutable borrow later used here
2020-03-25 05:17:06 -05:00
error[E0502]: cannot borrow value as immutable because it is also borrowed as mutable
--> $DIR/borrowck-pat-at-and-box.rs:52:25
|
LL | let ref mut a @ box ref b = Box::new(NC);
| ----------------^^^^^
| | |
| | immutable borrow occurs here
| mutable borrow occurs here
2019-12-14 17:32:20 -06:00
...
LL | *a = Box::new(NC);
| -- mutable borrow later used here
2020-03-25 05:17:06 -05:00
error[E0502]: cannot borrow value as immutable because it is also borrowed as mutable
--> $DIR/borrowck-pat-at-and-box.rs:66:25
|
LL | ref mut a @ box ref b => {
| ----------------^^^^^
| | |
| | immutable borrow occurs here
| mutable borrow occurs here
...
LL | *a = Box::new(NC);
| -- mutable borrow later used here
error[E0382]: use of moved value
--> $DIR/borrowck-pat-at-and-box.rs:27:20
|
LL | fn f1(a @ box &b: Box<&C>) {}
| ---------^
| | |
| | value used here after move
| value moved here
| move occurs because value has type `std::boxed::Box<&C>`, which does not implement the `Copy` trait
error[E0382]: use of moved value
--> $DIR/borrowck-pat-at-and-box.rs:30:19
|
LL | fn f2(a @ box b: Box<C>) {}
| --------^
| | |
| | value used here after move
| value moved here
| move occurs because value has type `std::boxed::Box<C>`, which does not implement the `Copy` trait
2020-03-25 05:17:06 -05:00
error[E0502]: cannot borrow value as immutable because it is also borrowed as mutable
--> $DIR/borrowck-pat-at-and-box.rs:58:27
|
LL | fn f5(ref mut a @ box ref b: Box<NC>) {
| ----------------^^^^^
| | |
| | immutable borrow occurs here
| mutable borrow occurs here
...
LL | *a = Box::new(NC);
| -- mutable borrow later used here
error: aborting due to 17 previous errors
Some errors have detailed explanations: E0382, E0502.
For more information about an error, try `rustc --explain E0382`.