diff options
Diffstat (limited to 'tests/ui/moves/matching-partially-moved-value-17385.rs')
| -rw-r--r-- | tests/ui/moves/matching-partially-moved-value-17385.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/ui/moves/matching-partially-moved-value-17385.rs b/tests/ui/moves/matching-partially-moved-value-17385.rs new file mode 100644 index 00000000000..c50fe048bfb --- /dev/null +++ b/tests/ui/moves/matching-partially-moved-value-17385.rs @@ -0,0 +1,30 @@ +// https://github.com/rust-lang/rust/issues/17385 +struct X(isize); + +enum Enum { + Variant1, + Variant2 +} + +impl Drop for X { + fn drop(&mut self) {} +} +impl Drop for Enum { + fn drop(&mut self) {} +} + +fn main() { + let foo = X(1); + drop(foo); + match foo { //~ ERROR use of moved value + X(1) => (), + _ => unreachable!() + } + + let e = Enum::Variant2; + drop(e); + match e { //~ ERROR use of moved value + Enum::Variant1 => unreachable!(), + Enum::Variant2 => () + } +} |
