2015-01-08 10:54:35 +00:00
|
|
|
struct X(isize);
|
2014-04-11 00:21:01 +00:00
|
|
|
|
2014-09-20 17:32:18 +00:00
|
|
|
enum Enum {
|
|
|
|
Variant1,
|
|
|
|
Variant2
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Drop for X {
|
|
|
|
fn drop(&mut self) {}
|
|
|
|
}
|
|
|
|
impl Drop for Enum {
|
|
|
|
fn drop(&mut self) {}
|
|
|
|
}
|
2014-04-11 00:21:01 +00:00
|
|
|
|
|
|
|
fn main() {
|
2015-01-31 16:23:42 +00:00
|
|
|
let foo = X(1);
|
2014-09-20 17:32:18 +00:00
|
|
|
drop(foo);
|
2021-07-23 22:55:36 +00:00
|
|
|
match foo { //~ ERROR use of moved value
|
|
|
|
X(1) => (),
|
2014-09-20 17:32:18 +00:00
|
|
|
_ => unreachable!()
|
|
|
|
}
|
2014-04-11 00:21:01 +00:00
|
|
|
|
2014-11-06 08:05:53 +00:00
|
|
|
let e = Enum::Variant2;
|
2014-09-20 17:32:18 +00:00
|
|
|
drop(e);
|
|
|
|
match e { //~ ERROR use of moved value
|
2014-11-06 08:05:53 +00:00
|
|
|
Enum::Variant1 => unreachable!(),
|
|
|
|
Enum::Variant2 => ()
|
2014-09-20 17:32:18 +00:00
|
|
|
}
|
2014-04-11 00:21:01 +00:00
|
|
|
}
|