rust/tests/ui/issues/issue-17385.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
466 B
Rust
Raw Normal View History

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() {
2015-01-31 16:23:42 +00:00
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 => ()
}
}