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