diff options
Diffstat (limited to 'tests/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.fixed')
-rw-r--r-- | tests/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.fixed | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.fixed b/tests/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.fixed new file mode 100644 index 000000000..c8a451efe --- /dev/null +++ b/tests/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.fixed @@ -0,0 +1,19 @@ +// run-rustfix +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 { + //~^ ERROR cannot move out of type `X`, which implements the `Drop` trait + X { x: ref y } => println!("contents: {}", y) + } +} |