2 // revisions: mirunsafeck thirunsafeck
3 // [thirunsafeck]compile-flags: -Z thir-unsafeck
6 #![allow(unused_variables)]
8 // Drop works for union itself.
10 #[derive(Copy, Clone)]
27 unsafe { CHECK += 1; }
33 unsafe { CHECK += 1; }
37 static mut CHECK: u8 = 0;
45 assert_eq!(CHECK, 1); // 1, dtor of U is called
49 assert_eq!(CHECK, 2); // 2, dtor of W is called
53 assert_eq!(CHECK, 2); // 2, Y has no dtor
58 assert_eq!(CHECK, 2); // 2, dtor of U *not* called for u2