2021-01-18 00:48:52 +00:00
|
|
|
// run-rustfix
|
2012-11-06 01:50:01 +00:00
|
|
|
struct Foo {
|
2015-01-08 10:54:35 +00:00
|
|
|
x: isize
|
2012-11-06 01:50:01 +00:00
|
|
|
}
|
|
|
|
|
2021-01-18 00:48:52 +00:00
|
|
|
#[allow(drop_bounds)]
|
|
|
|
trait Bar: Drop {
|
2013-03-13 02:32:14 +00:00
|
|
|
fn blah(&self);
|
2012-11-06 01:50:01 +00:00
|
|
|
}
|
|
|
|
|
2013-02-14 19:47:00 +00:00
|
|
|
impl Drop for Foo {
|
2013-09-17 01:18:07 +00:00
|
|
|
fn drop(&mut self) {
|
2014-01-09 10:06:55 +00:00
|
|
|
println!("kaboom");
|
2012-11-06 01:50:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-14 19:47:00 +00:00
|
|
|
impl Bar for Foo {
|
2013-03-13 02:32:14 +00:00
|
|
|
fn blah(&self) {
|
2014-12-05 23:53:30 +00:00
|
|
|
self.drop(); //~ ERROR explicit use of destructor method
|
2012-11-06 01:50:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let x = Foo { x: 3 };
|
2021-01-18 00:48:52 +00:00
|
|
|
println!("{}", x.x);
|
2012-11-06 01:50:01 +00:00
|
|
|
}
|