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