mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
24 lines
361 B
Rust
24 lines
361 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);
|
|
}
|
|
}
|