2024-02-16 20:02:50 +00:00
|
|
|
//@ run-rustfix
|
2016-05-19 14:00:43 +02:00
|
|
|
struct Foo {
|
|
|
|
|
x: i32,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl Drop for Foo {
|
|
|
|
|
fn drop(&mut self) {
|
|
|
|
|
println!("kaboom");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
let mut x = Foo { x: -7 };
|
2021-01-17 16:48:52 -08:00
|
|
|
x.x = 0;
|
|
|
|
|
println!("{}", x.x);
|
2016-08-04 22:46:59 -05:00
|
|
|
x.drop();
|
|
|
|
|
//~^ ERROR E0040
|
2016-05-19 14:00:43 +02:00
|
|
|
}
|