2015-03-25 17:06:52 -07:00
|
|
|
static mut DROP_RAN: isize = 0;
|
2014-08-06 11:59:40 +02:00
|
|
|
|
|
|
|
struct Foo;
|
|
|
|
impl Drop for Foo {
|
|
|
|
fn drop(&mut self) {
|
|
|
|
unsafe { DROP_RAN += 1; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-06 10:16:49 +13:00
|
|
|
struct Fat<T: ?Sized> {
|
2014-08-06 11:59:40 +02:00
|
|
|
f: T
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn main() {
|
|
|
|
{
|
2015-02-15 09:52:21 +01:00
|
|
|
let _x: Box<Fat<[Foo]>> = Box::<Fat<[Foo; 3]>>::new(Fat { f: [Foo, Foo, Foo] });
|
2014-08-06 11:59:40 +02:00
|
|
|
}
|
|
|
|
unsafe {
|
2015-06-07 21:00:38 +03:00
|
|
|
assert_eq!(DROP_RAN, 3);
|
2014-08-06 11:59:40 +02:00
|
|
|
}
|
|
|
|
}
|