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