1 #![allow(dead_code, cenum_impl_drop_cast)]
3 // check dtor calling order when casting enums.
6 use std
::sync
::atomic
::Ordering
;
15 static FLAG
: atomic
::AtomicUsize
= atomic
::AtomicUsize
::new(0);
20 unsafe { mem::forget(mem::replace(self, E::B)) }
;
22 FLAG
.store(FLAG
.load(Ordering
::SeqCst
)+1, Ordering
::SeqCst
);
27 assert_eq
!(FLAG
.load(Ordering
::SeqCst
), 0);
30 assert_eq
!(e
as u32, 2);
31 assert_eq
!(FLAG
.load(Ordering
::SeqCst
), 1);
33 assert_eq
!(FLAG
.load(Ordering
::SeqCst
), 1);