mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 23:12:02 +00:00
22 lines
340 B
Rust
22 lines
340 B
Rust
static mut DROP_RAN: isize = 0;
|
|
|
|
struct Foo;
|
|
impl Drop for Foo {
|
|
fn drop(&mut self) {
|
|
unsafe { DROP_RAN += 1; }
|
|
}
|
|
}
|
|
|
|
struct Fat<T: ?Sized> {
|
|
f: T
|
|
}
|
|
|
|
pub fn main() {
|
|
{
|
|
let _x: Box<Fat<[Foo]>> = Box::<Fat<[Foo; 3]>>::new(Fat { f: [Foo, Foo, Foo] });
|
|
}
|
|
unsafe {
|
|
assert_eq!(DROP_RAN, 3);
|
|
}
|
|
}
|