rust/tests/ui/issues/issue-17385.rs
2023-01-11 09:32:08 +00:00

30 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 => ()
}
}