]> git.lizzy.rs Git - rust.git/blob - tests/run-pass-valgrind/dst-dtor-1.rs
Rollup merge of #106889 - scottmcm:windows-mut, r=cuviper
[rust.git] / tests / run-pass-valgrind / dst-dtor-1.rs
1 static mut DROP_RAN: bool = false;
2
3 struct Foo;
4 impl Drop for Foo {
5     fn drop(&mut self) {
6         unsafe { DROP_RAN = true; }
7     }
8 }
9
10 trait Trait { fn dummy(&self) { } }
11 impl Trait for Foo {}
12
13 struct Fat<T: ?Sized> {
14     f: T
15 }
16
17 pub fn main() {
18     {
19         let _x: Box<Fat<Trait>> = Box::<Fat<Foo>>::new(Fat { f: Foo });
20     }
21     unsafe {
22         assert!(DROP_RAN);
23     }
24 }