1 // build-pass (FIXME(62277): could be check-pass?) 2 3 use std::cell::UnsafeCell; 4 use std::sync::atomic::AtomicU32; 5 pub struct Condvar { 6 condvar: UnsafeCell<AtomicU32>, 7 } 8 9 unsafe impl Send for Condvar {} 10 unsafe impl Sync for Condvar {} 11 12 #[repr(C)] 13 #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] 14 struct NoWait(u32); 15 16 const CONDVAR_HAS_NO_WAITERS: NoWait = NoWait(42); 17 18 impl Condvar { new() -> Condvar19 pub const fn new() -> Condvar { 20 Condvar { 21 condvar: UnsafeCell::new(AtomicU32::new(CONDVAR_HAS_NO_WAITERS.0)), 22 } 23 } 24 } 25 main()26fn main() {} 27