]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass-valgrind/dst-dtor-2.rs
Rollup merge of #59880 - solson:transmute-float, r=alexcrichton
[rust.git] / src / test / run-pass-valgrind / dst-dtor-2.rs
1 // no-prefer-dynamic
2
3 static mut DROP_RAN: isize = 0;
4
5 struct Foo;
6 impl Drop for Foo {
7     fn drop(&mut self) {
8         unsafe { DROP_RAN += 1; }
9     }
10 }
11
12 struct Fat<T: ?Sized> {
13     f: T
14 }
15
16 pub fn main() {
17     {
18         let _x: Box<Fat<[Foo]>> = Box::<Fat<[Foo; 3]>>::new(Fat { f: [Foo, Foo, Foo] });
19     }
20     unsafe {
21         assert_eq!(DROP_RAN, 3);
22     }
23 }