2018-08-08 07:28:26 -05:00
|
|
|
error[E0509]: cannot move out of type `X`, which implements the `Drop` trait
|
2022-12-08 19:14:56 -06:00
|
|
|
--> $DIR/disallowed-deconstructing-destructing-struct-match.rs:15:11
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
2019-04-22 02:40:08 -05:00
|
|
|
LL | match x {
|
|
|
|
| ^ cannot move out of here
|
|
|
|
LL |
|
2018-08-08 07:28:26 -05:00
|
|
|
LL | X { x: y } => println!("contents: {}", y)
|
2019-05-05 06:02:32 -05:00
|
|
|
| -
|
|
|
|
| |
|
|
|
|
| data moved here
|
2020-09-02 02:40:56 -05:00
|
|
|
| move occurs because `y` has type `String`, which does not implement the `Copy` trait
|
2022-12-08 19:14:56 -06:00
|
|
|
|
|
|
|
|
help: consider borrowing the pattern binding
|
|
|
|
|
|
|
|
|
LL | X { x: ref y } => println!("contents: {}", y)
|
|
|
|
| +++
|
2018-08-08 07:28:26 -05:00
|
|
|
|
2023-11-21 09:44:16 -06:00
|
|
|
error: aborting due to 1 previous error
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0509`.
|