4 #![allow(unused_variables)]
5 #![allow(unused_imports)]
6 // ignore-wasm32-bare compiled with panic=abort by default
8 // Test that builtin implementations of `Clone` cleanup everything
9 // in case of unwinding.
17 fn clone(&self) -> Self {
18 if Rc::strong_count(&self.0) == 7 {
27 let counter = Rc::new(());
29 // Unwinding with tuples...
30 let ccounter = counter.clone();
31 let result = std::panic::catch_unwind(move || {
40 assert!(result.is_err());
43 Rc::strong_count(&counter)
46 // ... and with arrays.
47 let ccounter = counter.clone();
48 let child = std::panic::catch_unwind(move || {
57 assert!(child.is_err());
60 Rc::strong_count(&counter)