diff options
| author | bors <bors@rust-lang.org> | 2014-04-08 08:16:52 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-04-08 08:16:52 -0700 |
| commit | 02f51211eddbbaf6c6e02cecc78957ce1d5b4600 (patch) | |
| tree | d7c5f1dbc4a37e473577b39abd56e2f1df433069 /src/libsync | |
| parent | e415c25bcd81dc1f9a5a3d25d9b48ed2d545336b (diff) | |
| parent | da8d4fddc6445c19ad434a1f104c1c310c6c3c34 (diff) | |
| download | rust-02f51211eddbbaf6c6e02cecc78957ce1d5b4600.tar.gz rust-02f51211eddbbaf6c6e02cecc78957ce1d5b4600.zip | |
auto merge of #13397 : alexcrichton/rust/rollup, r=alexcrichton
Diffstat (limited to 'src/libsync')
| -rw-r--r-- | src/libsync/arc.rs | 6 | ||||
| -rw-r--r-- | src/libsync/future.rs | 6 | ||||
| -rw-r--r-- | src/libsync/lock.rs | 12 | ||||
| -rw-r--r-- | src/libsync/task_pool.rs | 10 |
4 files changed, 15 insertions, 19 deletions
diff --git a/src/libsync/arc.rs b/src/libsync/arc.rs index ae76357a2be..ecfeade2fb4 100644 --- a/src/libsync/arc.rs +++ b/src/libsync/arc.rs @@ -124,12 +124,10 @@ impl<T: Share + Send> Clone for Arc<T> { } } -// FIXME(#13042): this should have T: Send, and use self.inner() -impl<T> Deref<T> for Arc<T> { +impl<T: Send + Share> Deref<T> for Arc<T> { #[inline] fn deref<'a>(&'a self) -> &'a T { - let inner = unsafe { &*self.x }; - &inner.data + &self.inner().data } } diff --git a/src/libsync/future.rs b/src/libsync/future.rs index cfe942afc12..ac4150a67e0 100644 --- a/src/libsync/future.rs +++ b/src/libsync/future.rs @@ -34,7 +34,7 @@ pub struct Future<A> { } enum FutureState<A> { - Pending(proc:Send() -> A), + Pending(proc():Send -> A), Evaluating, Forced(A) } @@ -90,7 +90,7 @@ impl<A> Future<A> { Future {state: Forced(val)} } - pub fn from_fn(f: proc:Send() -> A) -> Future<A> { + pub fn from_fn(f: proc():Send -> A) -> Future<A> { /*! * Create a future from a function. * @@ -117,7 +117,7 @@ impl<A:Send> Future<A> { }) } - pub fn spawn(blk: proc:Send() -> A) -> Future<A> { + pub fn spawn(blk: proc():Send -> A) -> Future<A> { /*! * Create a future from a unique closure. * diff --git a/src/libsync/lock.rs b/src/libsync/lock.rs index 67b725f040b..b83bdf9df29 100644 --- a/src/libsync/lock.rs +++ b/src/libsync/lock.rs @@ -231,11 +231,10 @@ impl<T: Send> Mutex<T> { } } -// FIXME(#13042): these should both have T: Send -impl<'a, T> Deref<T> for MutexGuard<'a, T> { +impl<'a, T: Send> Deref<T> for MutexGuard<'a, T> { fn deref<'a>(&'a self) -> &'a T { &*self.data } } -impl<'a, T> DerefMut<T> for MutexGuard<'a, T> { +impl<'a, T: Send> DerefMut<T> for MutexGuard<'a, T> { fn deref_mut<'a>(&'a mut self) -> &'a mut T { &mut *self.data } } @@ -363,14 +362,13 @@ impl<'a, T: Send + Share> RWLockWriteGuard<'a, T> { } } -// FIXME(#13042): these should all have T: Send + Share -impl<'a, T> Deref<T> for RWLockReadGuard<'a, T> { +impl<'a, T: Send + Share> Deref<T> for RWLockReadGuard<'a, T> { fn deref<'a>(&'a self) -> &'a T { self.data } } -impl<'a, T> Deref<T> for RWLockWriteGuard<'a, T> { +impl<'a, T: Send + Share> Deref<T> for RWLockWriteGuard<'a, T> { fn deref<'a>(&'a self) -> &'a T { &*self.data } } -impl<'a, T> DerefMut<T> for RWLockWriteGuard<'a, T> { +impl<'a, T: Send + Share> DerefMut<T> for RWLockWriteGuard<'a, T> { fn deref_mut<'a>(&'a mut self) -> &'a mut T { &mut *self.data } } diff --git a/src/libsync/task_pool.rs b/src/libsync/task_pool.rs index fc249996882..75e5d19b2e2 100644 --- a/src/libsync/task_pool.rs +++ b/src/libsync/task_pool.rs @@ -16,7 +16,7 @@ use std::task; enum Msg<T> { - Execute(proc:Send(&T)), + Execute(proc(&T):Send), Quit } @@ -41,7 +41,7 @@ impl<T> TaskPool<T> { /// returns a function which, given the index of the task, should return /// local data to be kept around in that task. pub fn new(n_tasks: uint, - init_fn_factory: || -> proc:Send(uint) -> T) + init_fn_factory: || -> proc(uint):Send -> T) -> TaskPool<T> { assert!(n_tasks >= 1); @@ -73,7 +73,7 @@ impl<T> TaskPool<T> { /// Executes the function `f` on a task in the pool. The function /// receives a reference to the local data returned by the `init_fn`. - pub fn execute(&mut self, f: proc:Send(&T)) { + pub fn execute(&mut self, f: proc(&T):Send) { self.channels.get(self.next_index).send(Execute(f)); self.next_index += 1; if self.next_index == self.channels.len() { self.next_index = 0; } @@ -82,8 +82,8 @@ impl<T> TaskPool<T> { #[test] fn test_task_pool() { - let f: || -> proc:Send(uint) -> uint = || { - let g: proc:Send(uint) -> uint = proc(i) i; + let f: || -> proc(uint):Send -> uint = || { + let g: proc(uint):Send -> uint = proc(i) i; g }; let mut pool = TaskPool::new(4, f); |
