mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-02 10:18:25 +00:00

Since deref patterns on boxes will be lowered differently, I'll be making a separate test file for them. This makes sure we're still testing the generic `Deref(Mut)::deref(_mut)`-based lowering.
73 lines
2.1 KiB
Plaintext
73 lines
2.1 KiB
Plaintext
error[E0508]: cannot move out of type `[Struct]`, a non-copy slice
|
|
--> $DIR/cant_move_out_of_pattern.rs:9:11
|
|
|
|
|
LL | match b {
|
|
| ^ cannot move out of here
|
|
LL |
|
|
LL | deref!([x]) => x,
|
|
| -
|
|
| |
|
|
| data moved here
|
|
| move occurs because `x` has type `Struct`, which does not implement the `Copy` trait
|
|
|
|
|
help: consider borrowing the pattern binding
|
|
|
|
|
LL | deref!([ref x]) => x,
|
|
| +++
|
|
|
|
error[E0507]: cannot move out of a shared reference
|
|
--> $DIR/cant_move_out_of_pattern.rs:17:11
|
|
|
|
|
LL | match rc {
|
|
| ^^
|
|
LL |
|
|
LL | deref!(x) => x,
|
|
| -
|
|
| |
|
|
| data moved here
|
|
| move occurs because `x` has type `Struct`, which does not implement the `Copy` trait
|
|
|
|
|
help: consider borrowing the pattern binding
|
|
|
|
|
LL | deref!(ref x) => x,
|
|
| +++
|
|
|
|
error[E0508]: cannot move out of type `[Struct]`, a non-copy slice
|
|
--> $DIR/cant_move_out_of_pattern.rs:25:11
|
|
|
|
|
LL | match b {
|
|
| ^ cannot move out of here
|
|
LL |
|
|
LL | [x] => x,
|
|
| -
|
|
| |
|
|
| data moved here
|
|
| move occurs because `x` has type `Struct`, which does not implement the `Copy` trait
|
|
|
|
|
help: consider borrowing the pattern binding
|
|
|
|
|
LL | [ref x] => x,
|
|
| +++
|
|
|
|
error[E0507]: cannot move out of a shared reference
|
|
--> $DIR/cant_move_out_of_pattern.rs:35:11
|
|
|
|
|
LL | match rc {
|
|
| ^^
|
|
LL |
|
|
LL | Container(x) => x,
|
|
| -
|
|
| |
|
|
| data moved here
|
|
| move occurs because `x` has type `Struct`, which does not implement the `Copy` trait
|
|
|
|
|
help: consider borrowing the pattern binding
|
|
|
|
|
LL | Container(ref x) => x,
|
|
| +++
|
|
|
|
error: aborting due to 4 previous errors
|
|
|
|
Some errors have detailed explanations: E0507, E0508.
|
|
For more information about an error, try `rustc --explain E0507`.
|