]> git.lizzy.rs Git - rust.git/blob - tests/run-pass-valgrind/dst-dtor-2.rs
Auto merge of #106646 - Amanieu:ilp32-object, r=Mark-Simulacrum
[rust.git] / tests / run-pass-valgrind / dst-dtor-2.rs
1 static mut DROP_RAN: isize = 0;
2
3 struct Foo;
4 impl Drop for Foo {
5     fn drop(&mut self) {
6         unsafe { DROP_RAN += 1; }
7     }
8 }
9
10 struct Fat<T: ?Sized> {
11     f: T
12 }
13
14 pub fn main() {
15     {
16         let _x: Box<Fat<[Foo]>> = Box::<Fat<[Foo; 3]>>::new(Fat { f: [Foo, Foo, Foo] });
17     }
18     unsafe {
19         assert_eq!(DROP_RAN, 3);
20     }
21 }