rust/tests/run-pass-valgrind/dst-dtor-1.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
405 B
Rust
Raw Normal View History

2014-08-06 04:59:40 -05:00
static mut DROP_RAN: bool = false;
struct Foo;
impl Drop for Foo {
fn drop(&mut self) {
2024-06-03 01:06:52 -05:00
unsafe {
DROP_RAN = true;
}
2014-08-06 04:59:40 -05:00
}
}
2024-06-03 01:06:52 -05:00
trait Trait {
fn dummy(&self) {}
}
2014-08-06 04:59:40 -05:00
impl Trait for Foo {}
2015-01-05 15:16:49 -06:00
struct Fat<T: ?Sized> {
2024-06-03 01:06:52 -05:00
f: T,
2014-08-06 04:59:40 -05:00
}
pub fn main() {
{
let _x: Box<Fat<Trait>> = Box::<Fat<Foo>>::new(Fat { f: Foo });
2014-08-06 04:59:40 -05:00
}
unsafe {
assert!(DROP_RAN);
}
}