mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
29 lines
466 B
Rust
29 lines
466 B
Rust
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 => ()
|
|
}
|
|
}
|