]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass-valgrind/dst-dtor-3.rs
Merge remote-tracking branch 'origin/master' into azure-pipelines
[rust.git] / src / test / run-pass-valgrind / dst-dtor-3.rs
1 // no-prefer-dynamic
2
3 #![feature(unsized_tuple_coercion)]
4
5 static mut DROP_RAN: bool = false;
6
7 struct Foo;
8 impl Drop for Foo {
9     fn drop(&mut self) {
10         unsafe { DROP_RAN = true; }
11     }
12 }
13
14 trait Trait { fn dummy(&self) { } }
15 impl Trait for Foo {}
16
17 pub fn main() {
18     {
19         let _x: Box<(i32, Trait)> = Box::<(i32, Foo)>::new((42, Foo));
20     }
21     unsafe {
22         assert!(DROP_RAN);
23     }
24 }