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