use core::prelude::*;
-use core::ty::Unsafe;
+use core::cell::UnsafeCell;
use mutex;
/// An OS mutex over some data.
/// > as part of `libsync` should almost always be favored.
pub struct Exclusive<T> {
lock: mutex::NativeMutex,
- data: Unsafe<T>,
+ data: UnsafeCell<T>,
}
/// An RAII guard returned via `lock`
-pub struct ExclusiveGuard<'a, T> {
+pub struct ExclusiveGuard<'a, T:'a> {
// FIXME #12808: strange name to try to avoid interfering with
// field accesses of the contained type via Deref
_data: &'a mut T,
pub fn new(user_data: T) -> Exclusive<T> {
Exclusive {
lock: unsafe { mutex::NativeMutex::new() },
- data: Unsafe::new(user_data),
+ data: UnsafeCell::new(user_data),
}
}
});
};
- for f in futures.mut_iter() { f.recv() }
+ for f in futures.iter_mut() { f.recv() }
assert_eq!(**total.lock(), num_tasks * count);
}