2019-11-11 04:39:52 -06:00
|
|
|
warning: the feature `bindings_after_at` is incomplete and may cause the compiler to crash
|
|
|
|
--> $DIR/borrowck-pat-at-and-box.rs:3:12
|
|
|
|
|
|
|
|
|
LL | #![feature(bindings_after_at)]
|
|
|
|
| ^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= note: `#[warn(incomplete_features)]` on by default
|
|
|
|
|
|
|
|
error[E0007]: cannot bind by-move with sub-bindings
|
|
|
|
--> $DIR/borrowck-pat-at-and-box.rs:11:9
|
|
|
|
|
|
|
|
|
LL | let a @ box &b = Box::new(&C);
|
|
|
|
| ^^^^^^^^^^ binds an already bound by-move value by moving it
|
|
|
|
|
|
|
|
error[E0007]: cannot bind by-move with sub-bindings
|
|
|
|
--> $DIR/borrowck-pat-at-and-box.rs:15:9
|
|
|
|
|
|
|
|
|
LL | let a @ box b = Box::new(C);
|
|
|
|
| ^^^^^^^^^ binds an already bound by-move value by moving it
|
|
|
|
|
|
|
|
error[E0009]: cannot bind by-move and by-ref in the same pattern
|
|
|
|
--> $DIR/borrowck-pat-at-and-box.rs:26:21
|
|
|
|
|
|
|
|
|
LL | let ref a @ box b = Box::new(NC);
|
|
|
|
| ------------^
|
|
|
|
| | |
|
|
|
|
| | by-move pattern here
|
2019-12-14 11:20:13 -06:00
|
|
|
| by-ref pattern here
|
2019-11-11 04:39:52 -06:00
|
|
|
|
2019-12-14 17:32:20 -06:00
|
|
|
error: cannot borrow `a` as mutable because it is also borrowed as immutable
|
|
|
|
--> $DIR/borrowck-pat-at-and-box.rs:32:9
|
|
|
|
|
|
|
|
|
LL | let ref a @ box ref mut b = Box::new(NC);
|
|
|
|
| -----^^^^^^^---------
|
|
|
|
| | |
|
|
|
|
| | mutable borrow occurs here
|
|
|
|
| immutable borrow occurs here
|
|
|
|
|
|
|
|
error: cannot borrow `a` as mutable because it is also borrowed as immutable
|
|
|
|
--> $DIR/borrowck-pat-at-and-box.rs:34:9
|
|
|
|
|
|
|
|
|
LL | let ref a @ box ref mut b = Box::new(NC);
|
|
|
|
| -----^^^^^^^---------
|
|
|
|
| | |
|
|
|
|
| | mutable borrow occurs here
|
|
|
|
| immutable borrow occurs here
|
|
|
|
|
|
|
|
error: cannot borrow `a` as mutable because it is also borrowed as immutable
|
|
|
|
--> $DIR/borrowck-pat-at-and-box.rs:37:9
|
|
|
|
|
|
|
|
|
LL | let ref a @ box ref mut b = Box::new(NC);
|
|
|
|
| -----^^^^^^^---------
|
|
|
|
| | |
|
|
|
|
| | mutable borrow occurs here
|
|
|
|
| immutable borrow occurs here
|
|
|
|
|
|
|
|
error: cannot borrow `a` as immutable because it is also borrowed as mutable
|
|
|
|
--> $DIR/borrowck-pat-at-and-box.rs:43:9
|
|
|
|
|
|
|
|
|
LL | let ref mut a @ box ref b = Box::new(NC);
|
|
|
|
| ---------^^^^^^^-----
|
|
|
|
| | |
|
|
|
|
| | immutable borrow occurs here
|
|
|
|
| mutable borrow occurs here
|
|
|
|
|
2019-11-11 04:39:52 -06:00
|
|
|
error[E0382]: use of moved value
|
|
|
|
--> $DIR/borrowck-pat-at-and-box.rs:11: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:15: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[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable
|
2019-12-14 17:32:20 -06:00
|
|
|
--> $DIR/borrowck-pat-at-and-box.rs:37:21
|
2019-11-11 04:39:52 -06:00
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
error[E0502]: cannot borrow `_` as immutable because it is also borrowed as mutable
|
2019-12-14 17:32:20 -06:00
|
|
|
--> $DIR/borrowck-pat-at-and-box.rs:43:25
|
2019-11-11 04:39:52 -06:00
|
|
|
|
|
|
|
|
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
|
|
|
...
|
2019-11-11 04:39:52 -06:00
|
|
|
LL | *a = Box::new(NC);
|
|
|
|
| -- mutable borrow later used here
|
|
|
|
|
2019-12-14 17:32:20 -06:00
|
|
|
error: aborting due to 11 previous errors
|
2019-11-11 04:39:52 -06:00
|
|
|
|
|
|
|
Some errors have detailed explanations: E0007, E0009, E0382, E0502.
|
|
|
|
For more information about an error, try `rustc --explain E0007`.
|