2021-01-17 16:48:52 -08:00
|
|
|
//@ run-rustfix
|
2012-11-05 17:50:01 -08:00
|
|
|
struct Foo {
|
2015-01-08 21:54:35 +11:00
|
|
|
x: isize
|
2012-11-05 17:50:01 -08:00
|
|
|
}
|
|
|
|
|
2013-02-14 11:47:00 -08:00
|
|
|
impl Drop for Foo {
|
2013-09-16 21:18:07 -04:00
|
|
|
fn drop(&mut self) {
|
2014-01-09 21:06:55 +11:00
|
|
|
println!("kaboom");
|
2012-11-05 17:50:01 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let x = Foo { x: 3 };
|
2021-01-17 16:48:52 -08:00
|
|
|
println!("{}", x.x);
|
2014-12-05 15:53:30 -08:00
|
|
|
x.drop(); //~ ERROR explicit use of destructor method
|
2012-11-05 17:50:01 -08:00
|
|
|
}
|