about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-12-11 13:50:04 -0800
committerBrian Anderson <banderson@mozilla.com>2012-12-13 15:52:50 -0800
commited4fac01b5e207df0f0c7e0ea964bd3088826d27 (patch)
treeabae4bd8b385afdfbba28988560992683102970b /src/libstd
parenta277081ee481174cd28f7e85aaf1c4de912cbf4f (diff)
downloadrust-ed4fac01b5e207df0f0c7e0ea964bd3088826d27.tar.gz
rust-ed4fac01b5e207df0f0c7e0ea964bd3088826d27.zip
Rename Send trait to Owned
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/arc.rs50
-rw-r--r--src/libstd/comm.rs14
-rw-r--r--src/libstd/future.rs4
-rw-r--r--src/libstd/par.rs13
-rw-r--r--src/libstd/sync.rs10
-rw-r--r--src/libstd/timer.rs4
-rw-r--r--src/libstd/workcache.rs10
7 files changed, 53 insertions, 52 deletions
diff --git a/src/libstd/arc.rs b/src/libstd/arc.rs
index eacb310ee02..e2bbda46d7c 100644
--- a/src/libstd/arc.rs
+++ b/src/libstd/arc.rs
@@ -73,10 +73,10 @@ impl &Condvar {
  ****************************************************************************/
 
 /// An atomically reference counted wrapper for shared immutable state.
-struct ARC<T: Const Send> { x: SharedMutableState<T> }
+struct ARC<T: Const Owned> { x: SharedMutableState<T> }
 
 /// Create an atomically reference counted wrapper.
-pub fn ARC<T: Const Send>(data: T) -> ARC<T> {
+pub fn ARC<T: Const Owned>(data: T) -> ARC<T> {
     ARC { x: unsafe { shared_mutable_state(move data) } }
 }
 
@@ -84,7 +84,7 @@ pub fn ARC<T: Const Send>(data: T) -> ARC<T> {
  * Access the underlying data in an atomically reference counted
  * wrapper.
  */
-pub fn get<T: Const Send>(rc: &a/ARC<T>) -> &a/T {
+pub fn get<T: Const Owned>(rc: &a/ARC<T>) -> &a/T {
     unsafe { get_shared_immutable_state(&rc.x) }
 }
 
@@ -95,7 +95,7 @@ pub fn get<T: Const Send>(rc: &a/ARC<T>) -> &a/T {
  * object. However, one of the `arc` objects can be sent to another task,
  * allowing them to share the underlying data.
  */
-pub fn clone<T: Const Send>(rc: &ARC<T>) -> ARC<T> {
+pub fn clone<T: Const Owned>(rc: &ARC<T>) -> ARC<T> {
     ARC { x: unsafe { clone_shared_mutable_state(&rc.x) } }
 }
 
@@ -108,12 +108,12 @@ pub fn clone<T: Const Send>(rc: &ARC<T>) -> ARC<T> {
  * unwrap from a task that holds another reference to the same ARC; it is
  * guaranteed to deadlock.
  */
-fn unwrap<T: Const Send>(rc: ARC<T>) -> T {
+fn unwrap<T: Const Owned>(rc: ARC<T>) -> T {
     let ARC { x: x } = move rc;
     unsafe { unwrap_shared_mutable_state(move x) }
 }
 
-impl<T: Const Send> ARC<T>: Clone {
+impl<T: Const Owned> ARC<T>: Clone {
     fn clone(&self) -> ARC<T> {
         clone(self)
     }
@@ -124,19 +124,19 @@ impl<T: Const Send> ARC<T>: Clone {
  ****************************************************************************/
 
 #[doc(hidden)]
-struct MutexARCInner<T: Send> { lock: Mutex, failed: bool, data: T }
+struct MutexARCInner<T: Owned> { lock: Mutex, failed: bool, data: T }
 /// An ARC with mutable data protected by a blocking mutex.
-struct MutexARC<T: Send> { x: SharedMutableState<MutexARCInner<T>> }
+struct MutexARC<T: Owned> { x: SharedMutableState<MutexARCInner<T>> }
 
 /// Create a mutex-protected ARC with the supplied data.
-pub fn MutexARC<T: Send>(user_data: T) -> MutexARC<T> {
+pub fn MutexARC<T: Owned>(user_data: T) -> MutexARC<T> {
     mutex_arc_with_condvars(move user_data, 1)
 }
 /**
  * Create a mutex-protected ARC with the supplied data and a specified number
  * of condvars (as sync::mutex_with_condvars).
  */
-pub fn mutex_arc_with_condvars<T: Send>(user_data: T,
+pub fn mutex_arc_with_condvars<T: Owned>(user_data: T,
                                     num_condvars: uint) -> MutexARC<T> {
     let data =
         MutexARCInner { lock: mutex_with_condvars(num_condvars),
@@ -144,7 +144,7 @@ pub fn mutex_arc_with_condvars<T: Send>(user_data: T,
     MutexARC { x: unsafe { shared_mutable_state(move data) } }
 }
 
-impl<T: Send> MutexARC<T>: Clone {
+impl<T: Owned> MutexARC<T>: Clone {
     /// Duplicate a mutex-protected ARC, as arc::clone.
     fn clone(&self) -> MutexARC<T> {
         // NB: Cloning the underlying mutex is not necessary. Its reference
@@ -153,7 +153,7 @@ impl<T: Send> MutexARC<T>: Clone {
     }
 }
 
-impl<T: Send> &MutexARC<T> {
+impl<T: Owned> &MutexARC<T> {
 
     /**
      * Access the underlying mutable data with mutual exclusion from other
@@ -210,7 +210,7 @@ impl<T: Send> &MutexARC<T> {
  * Will additionally fail if another task has failed while accessing the arc.
  */
 // FIXME(#3724) make this a by-move method on the arc
-pub fn unwrap_mutex_arc<T: Send>(arc: MutexARC<T>) -> T {
+pub fn unwrap_mutex_arc<T: Owned>(arc: MutexARC<T>) -> T {
     let MutexARC { x: x } = move arc;
     let inner = unsafe { unwrap_shared_mutable_state(move x) };
     let MutexARCInner { failed: failed, data: data, _ } = move inner;
@@ -256,27 +256,27 @@ fn PoisonOnFail(failed: &r/mut bool) -> PoisonOnFail/&r {
  ****************************************************************************/
 
 #[doc(hidden)]
-struct RWARCInner<T: Const Send> { lock: RWlock, failed: bool, data: T }
+struct RWARCInner<T: Const Owned> { lock: RWlock, failed: bool, data: T }
 /**
  * A dual-mode ARC protected by a reader-writer lock. The data can be accessed
  * mutably or immutably, and immutably-accessing tasks may run concurrently.
  *
  * Unlike mutex_arcs, rw_arcs are safe, because they cannot be nested.
  */
-struct RWARC<T: Const Send> {
+struct RWARC<T: Const Owned> {
     x: SharedMutableState<RWARCInner<T>>,
     mut cant_nest: ()
 }
 
 /// Create a reader/writer ARC with the supplied data.
-pub fn RWARC<T: Const Send>(user_data: T) -> RWARC<T> {
+pub fn RWARC<T: Const Owned>(user_data: T) -> RWARC<T> {
     rw_arc_with_condvars(move user_data, 1)
 }
 /**
  * Create a reader/writer ARC with the supplied data and a specified number
  * of condvars (as sync::rwlock_with_condvars).
  */
-pub fn rw_arc_with_condvars<T: Const Send>(user_data: T,
+pub fn rw_arc_with_condvars<T: Const Owned>(user_data: T,
                                        num_condvars: uint) -> RWARC<T> {
     let data =
         RWARCInner { lock: rwlock_with_condvars(num_condvars),
@@ -284,7 +284,7 @@ pub fn rw_arc_with_condvars<T: Const Send>(user_data: T,
     RWARC { x: unsafe { shared_mutable_state(move data) }, cant_nest: () }
 }
 
-impl<T: Const Send> RWARC<T> {
+impl<T: Const Owned> RWARC<T> {
     /// Duplicate a rwlock-protected ARC, as arc::clone.
     fn clone(&self) -> RWARC<T> {
         RWARC { x: unsafe { clone_shared_mutable_state(&self.x) },
@@ -293,7 +293,7 @@ impl<T: Const Send> RWARC<T> {
 
 }
 
-impl<T: Const Send> &RWARC<T> {
+impl<T: Const Owned> &RWARC<T> {
     /**
      * Access the underlying data mutably. Locks the rwlock in write mode;
      * other readers and writers will block.
@@ -394,7 +394,7 @@ impl<T: Const Send> &RWARC<T> {
  * in write mode.
  */
 // FIXME(#3724) make this a by-move method on the arc
-pub fn unwrap_rw_arc<T: Const Send>(arc: RWARC<T>) -> T {
+pub fn unwrap_rw_arc<T: Const Owned>(arc: RWARC<T>) -> T {
     let RWARC { x: x, _ } = move arc;
     let inner = unsafe { unwrap_shared_mutable_state(move x) };
     let RWARCInner { failed: failed, data: data, _ } = move inner;
@@ -408,19 +408,19 @@ pub fn unwrap_rw_arc<T: Const Send>(arc: RWARC<T>) -> T {
 // lock it. This wraps the unsafety, with the justification that the 'lock'
 // field is never overwritten; only 'failed' and 'data'.
 #[doc(hidden)]
-fn borrow_rwlock<T: Const Send>(state: &r/mut RWARCInner<T>) -> &r/RWlock {
+fn borrow_rwlock<T: Const Owned>(state: &r/mut RWARCInner<T>) -> &r/RWlock {
     unsafe { cast::transmute_immut(&mut state.lock) }
 }
 
 // FIXME (#3154) ice with struct/&<T> prevents these from being structs.
 
 /// The "write permission" token used for RWARC.write_downgrade().
-pub enum RWWriteMode<T: Const Send> =
+pub enum RWWriteMode<T: Const Owned> =
     (&mut T, sync::RWlockWriteMode, PoisonOnFail);
 /// The "read permission" token used for RWARC.write_downgrade().
-pub enum RWReadMode<T:Const Send> = (&T, sync::RWlockReadMode);
+pub enum RWReadMode<T:Const Owned> = (&T, sync::RWlockReadMode);
 
-impl<T: Const Send> &RWWriteMode<T> {
+impl<T: Const Owned> &RWWriteMode<T> {
     /// Access the pre-downgrade RWARC in write mode.
     fn write<U>(blk: fn(x: &mut T) -> U) -> U {
         match *self {
@@ -446,7 +446,7 @@ impl<T: Const Send> &RWWriteMode<T> {
     }
 }
 
-impl<T: Const Send> &RWReadMode<T> {
+impl<T: Const Owned> &RWReadMode<T> {
     /// Access the post-downgrade rwlock in read mode.
     fn read<U>(blk: fn(x: &T) -> U) -> U {
         match *self {
diff --git a/src/libstd/comm.rs b/src/libstd/comm.rs
index 49c5df2a28e..1055f3ea7df 100644
--- a/src/libstd/comm.rs
+++ b/src/libstd/comm.rs
@@ -21,24 +21,24 @@ use pipes::{GenericChan, GenericSmartChan, GenericPort,
             Chan, Port, Selectable, Peekable};
 
 /// An extension of `pipes::stream` that allows both sending and receiving.
-pub struct DuplexStream<T: Send, U: Send> {
+pub struct DuplexStream<T: Owned, U: Owned> {
     priv chan: Chan<T>,
     priv port: Port<U>,
 }
 
-impl<T: Send, U: Send> DuplexStream<T, U> : GenericChan<T> {
+impl<T: Owned, U: Owned> DuplexStream<T, U> : GenericChan<T> {
     fn send(x: T) {
         self.chan.send(move x)
     }
 }
 
-impl<T: Send, U: Send> DuplexStream<T, U> : GenericSmartChan<T> {
+impl<T: Owned, U: Owned> DuplexStream<T, U> : GenericSmartChan<T> {
     fn try_send(x: T) -> bool {
         self.chan.try_send(move x)
     }
 }
 
-impl<T: Send, U: Send> DuplexStream<T, U> : GenericPort<U> {
+impl<T: Owned, U: Owned> DuplexStream<T, U> : GenericPort<U> {
     fn recv() -> U {
         self.port.recv()
     }
@@ -48,20 +48,20 @@ impl<T: Send, U: Send> DuplexStream<T, U> : GenericPort<U> {
     }
 }
 
-impl<T: Send, U: Send> DuplexStream<T, U> : Peekable<U> {
+impl<T: Owned, U: Owned> DuplexStream<T, U> : Peekable<U> {
     pure fn peek() -> bool {
         self.port.peek()
     }
 }
 
-impl<T: Send, U: Send> DuplexStream<T, U> : Selectable {
+impl<T: Owned, U: Owned> DuplexStream<T, U> : Selectable {
     pure fn header() -> *pipes::PacketHeader {
         self.port.header()
     }
 }
 
 /// Creates a bidirectional stream.
-pub fn DuplexStream<T: Send, U: Send>()
+pub fn DuplexStream<T: Owned, U: Owned>()
     -> (DuplexStream<T, U>, DuplexStream<U, T>)
 {
     let (p1, c2) = pipes::stream();
diff --git a/src/libstd/future.rs b/src/libstd/future.rs
index 960098c1db6..2a72c2f696a 100644
--- a/src/libstd/future.rs
+++ b/src/libstd/future.rs
@@ -89,7 +89,7 @@ pub fn from_value<A>(val: A) -> Future<A> {
     Future {state: Forced(move val)}
 }
 
-pub fn from_port<A:Send>(port: PortOne<A>) ->
+pub fn from_port<A:Owned>(port: PortOne<A>) ->
         Future<A> {
     /*!
      * Create a future from a port
@@ -121,7 +121,7 @@ pub fn from_fn<A>(f: ~fn() -> A) -> Future<A> {
     Future {state: Pending(move f)}
 }
 
-pub fn spawn<A:Send>(blk: fn~() -> A) -> Future<A> {
+pub fn spawn<A:Owned>(blk: fn~() -> A) -> Future<A> {
     /*!
      * Create a future from a unique closure.
      *
diff --git a/src/libstd/par.rs b/src/libstd/par.rs
index 7cf9c2c3771..55f88d4427c 100644
--- a/src/libstd/par.rs
+++ b/src/libstd/par.rs
@@ -29,7 +29,7 @@ const min_granularity : uint = 1024u;
  * This is used to build most of the other parallel vector functions,
  * like map or alli.
  */
-fn map_slices<A: Copy Send, B: Copy Send>(
+fn map_slices<A: Copy Owned, B: Copy Owned>(
     xs: &[A],
     f: fn() -> fn~(uint, v: &[A]) -> B)
     -> ~[B] {
@@ -84,7 +84,8 @@ fn map_slices<A: Copy Send, B: Copy Send>(
 }
 
 /// A parallel version of map.
-pub fn map<A: Copy Send, B: Copy Send>(xs: &[A], f: fn~((&A)) -> B) -> ~[B] {
+pub fn map<A: Copy Owned, B: Copy Owned>(
+    xs: &[A], f: fn~((&A)) -> B) -> ~[B] {
     vec::concat(map_slices(xs, || {
         fn~(_base: uint, slice : &[A], copy f) -> ~[B] {
             vec::map(slice, |x| f(x))
@@ -93,7 +94,7 @@ pub fn map<A: Copy Send, B: Copy Send>(xs: &[A], f: fn~((&A)) -> B) -> ~[B] {
 }
 
 /// A parallel version of mapi.
-pub fn mapi<A: Copy Send, B: Copy Send>(xs: &[A],
+pub fn mapi<A: Copy Owned, B: Copy Owned>(xs: &[A],
                                     f: fn~(uint, (&A)) -> B) -> ~[B] {
     let slices = map_slices(xs, || {
         fn~(base: uint, slice : &[A], copy f) -> ~[B] {
@@ -114,7 +115,7 @@ pub fn mapi<A: Copy Send, B: Copy Send>(xs: &[A],
  * In this case, f is a function that creates functions to run over the
  * inner elements. This is to skirt the need for copy constructors.
  */
-pub fn mapi_factory<A: Copy Send, B: Copy Send>(
+pub fn mapi_factory<A: Copy Owned, B: Copy Owned>(
     xs: &[A], f: fn() -> fn~(uint, A) -> B) -> ~[B] {
     let slices = map_slices(xs, || {
         let f = f();
@@ -131,7 +132,7 @@ pub fn mapi_factory<A: Copy Send, B: Copy Send>(
 }
 
 /// Returns true if the function holds for all elements in the vector.
-pub fn alli<A: Copy Send>(xs: &[A], f: fn~(uint, (&A)) -> bool) -> bool {
+pub fn alli<A: Copy Owned>(xs: &[A], f: fn~(uint, (&A)) -> bool) -> bool {
     do vec::all(map_slices(xs, || {
         fn~(base: uint, slice : &[A], copy f) -> bool {
             vec::alli(slice, |i, x| {
@@ -142,7 +143,7 @@ pub fn alli<A: Copy Send>(xs: &[A], f: fn~(uint, (&A)) -> bool) -> bool {
 }
 
 /// Returns true if the function holds for any elements in the vector.
-pub fn any<A: Copy Send>(xs: &[A], f: fn~(&(A)) -> bool) -> bool {
+pub fn any<A: Copy Owned>(xs: &[A], f: fn~(&(A)) -> bool) -> bool {
     do vec::any(map_slices(xs, || {
         fn~(_base : uint, slice: &[A], copy f) -> bool {
             vec::any(slice, |x| f(x))
diff --git a/src/libstd/sync.rs b/src/libstd/sync.rs
index 7506f1ea7bd..e1b029c5396 100644
--- a/src/libstd/sync.rs
+++ b/src/libstd/sync.rs
@@ -76,10 +76,10 @@ struct SemInner<Q> {
     blocked:   Q
 }
 #[doc(hidden)]
-enum Sem<Q: Send> = Exclusive<SemInner<Q>>;
+enum Sem<Q: Owned> = Exclusive<SemInner<Q>>;
 
 #[doc(hidden)]
-fn new_sem<Q: Send>(count: int, q: Q) -> Sem<Q> {
+fn new_sem<Q: Owned>(count: int, q: Q) -> Sem<Q> {
     Sem(exclusive(SemInner {
         mut count: count, waiters: new_waitqueue(), blocked: move q }))
 }
@@ -94,7 +94,7 @@ fn new_sem_and_signal(count: int, num_condvars: uint)
 }
 
 #[doc(hidden)]
-impl<Q: Send> &Sem<Q> {
+impl<Q: Owned> &Sem<Q> {
     fn acquire() {
         let mut waiter_nobe = None;
         unsafe {
@@ -160,9 +160,9 @@ impl &Sem<~[mut Waitqueue]> {
 #[doc(hidden)]
 type SemRelease = SemReleaseGeneric<()>;
 type SemAndSignalRelease = SemReleaseGeneric<~[mut Waitqueue]>;
-struct SemReleaseGeneric<Q: Send> { sem: &Sem<Q> }
+struct SemReleaseGeneric<Q: Owned> { sem: &Sem<Q> }
 
-impl<Q: Send> SemReleaseGeneric<Q> : Drop {
+impl<Q: Owned> SemReleaseGeneric<Q> : Drop {
     fn finalize(&self) {
         self.sem.release();
     }
diff --git a/src/libstd/timer.rs b/src/libstd/timer.rs
index c9754ad9980..a9638ad05c3 100644
--- a/src/libstd/timer.rs
+++ b/src/libstd/timer.rs
@@ -32,7 +32,7 @@ use comm = core::comm;
  * * ch - a channel of type T to send a `val` on
  * * val - a value of type T to send over the provided `ch`
  */
-pub fn delayed_send<T: Send>(iotask: IoTask,
+pub fn delayed_send<T: Owned>(iotask: IoTask,
                                   msecs: uint, ch: comm::Chan<T>, val: T) {
         unsafe {
             let timer_done_po = core::comm::Port::<()>();
@@ -108,7 +108,7 @@ pub fn sleep(iotask: IoTask, msecs: uint) {
  * on the provided port in the allotted timeout period, then the result will
  * be a `some(T)`. If not, then `none` will be returned.
  */
-pub fn recv_timeout<T: Copy Send>(iotask: IoTask,
+pub fn recv_timeout<T: Copy Owned>(iotask: IoTask,
                               msecs: uint,
                               wait_po: comm::Port<T>) -> Option<T> {
     let timeout_po = comm::Port::<()>();
diff --git a/src/libstd/workcache.rs b/src/libstd/workcache.rs
index 1defca9b205..8b394443170 100644
--- a/src/libstd/workcache.rs
+++ b/src/libstd/workcache.rs
@@ -166,7 +166,7 @@ struct Exec {
     discovered_outputs: WorkMap
 }
 
-struct Work<T:Send> {
+struct Work<T:Owned> {
     prep: @mut Prep,
     res: Option<Either<T,PortOne<(Exec,T)>>>
 }
@@ -197,7 +197,7 @@ impl Context {
         Context {db: db, logger: lg, cfg: cfg, freshness: LinearMap()}
     }
 
-    fn prep<T:Send
+    fn prep<T:Owned
               Serializable<json::Serializer>
               Deserializable<json::Deserializer>>(
                   @self,
@@ -245,7 +245,7 @@ impl Prep {
         return true;
     }
 
-    fn exec<T:Send
+    fn exec<T:Owned
               Serializable<json::Serializer>
               Deserializable<json::Deserializer>>(
                   @mut self, blk: ~fn(&Exec) -> T) -> Work<T> {
@@ -291,7 +291,7 @@ impl Prep {
     }
 }
 
-impl<T:Send
+impl<T:Owned
        Serializable<json::Serializer>
        Deserializable<json::Deserializer>>
     Work<T> {
@@ -301,7 +301,7 @@ impl<T:Send
 }
 
 // FIXME (#3724): movable self. This should be in impl Work.
-fn unwrap<T:Send
+fn unwrap<T:Owned
             Serializable<json::Serializer>
             Deserializable<json::Deserializer>>(w: Work<T>) -> T {