rust/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.rs
2018-12-25 21:08:33 -07:00

19 lines
329 B
Rust

struct X {
x: String,
}
impl Drop for X {
fn drop(&mut self) {
println!("value: {}", self.x);
}
}
fn main() {
let x = X { x: "hello".to_string() };
match x {
X { x: y } => println!("contents: {}", y)
//~^ ERROR cannot move out of type `X`, which implements the `Drop` trait
}
}