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

76 lines
2.7 KiB
Plaintext
Raw Normal View History

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
| by-ref pattern here
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
--> $DIR/borrowck-pat-at-and-box.rs:35: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
error[E0502]: cannot borrow `_` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-pat-at-and-box.rs:40:25
|
LL | let ref mut a @ box ref b = Box::new(NC);
| ----------------^^^^^
| | |
| | immutable borrow occurs here
| mutable borrow occurs here
LL |
LL | *a = Box::new(NC);
| -- mutable borrow later used here
error: aborting due to 7 previous errors
Some errors have detailed explanations: E0007, E0009, E0382, E0502.
For more information about an error, try `rustc --explain E0007`.