]> git.lizzy.rs Git - rust.git/blob - tests/run-pass-valgrind/dst-dtor-3.rs
Rollup merge of #107780 - compiler-errors:instantiate-binder, r=lcnr
[rust.git] / tests / run-pass-valgrind / dst-dtor-3.rs
1 #![feature(unsized_tuple_coercion)]
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 pub fn main() {
16     {
17         let _x: Box<(i32, Trait)> = Box::<(i32, Foo)>::new((42, Foo));
18     }
19     unsafe {
20         assert!(DROP_RAN);
21     }
22 }