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

25 lines
381 B
Rust
Raw Normal View History

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