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() {
|
|
|
|
{
|
2015-02-15 02:52:21 -06:00
|
|
|
let _x: Box<Fat<Trait>> = Box::<Fat<Foo>>::new(Fat { f: Foo });
|
2014-08-06 04:59:40 -05:00
|
|
|
}
|
|
|
|
unsafe {
|
|
|
|
assert!(DROP_RAN);
|
|
|
|
}
|
|
|
|
}
|