]>
git.proxmox.com Git - rustc.git/blob - tests/ui/builtin-clone-unwind.rs
4 #![allow(unused_variables)]
5 #![allow(unused_imports)]
7 // Test that builtin implementations of `Clone` cleanup everything
8 // in case of unwinding.
16 fn clone(&self) -> Self {
17 if Rc
::strong_count(&self.0) == 7 {
26 let counter
= Rc
::new(());
28 // Unwinding with tuples...
29 let ccounter
= counter
.clone();
30 let result
= std
::panic
::catch_unwind(move || {
39 assert
!(result
.is_err());
42 Rc
::strong_count(&counter
)
45 // ... and with arrays.
46 let ccounter
= counter
.clone();
47 let child
= std
::panic
::catch_unwind(move || {
56 assert
!(child
.is_err());
59 Rc
::strong_count(&counter
)