diff options
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/arc.rs | 44 | ||||
| -rw-r--r-- | src/libstd/c_vec.rs | 4 | ||||
| -rw-r--r-- | src/libstd/comm.rs | 4 | ||||
| -rw-r--r-- | src/libstd/deque.rs | 10 | ||||
| -rw-r--r-- | src/libstd/fun_treemap.rs | 6 | ||||
| -rw-r--r-- | src/libstd/json.rs | 2 | ||||
| -rw-r--r-- | src/libstd/list.rs | 20 | ||||
| -rw-r--r-- | src/libstd/map.rs | 42 | ||||
| -rw-r--r-- | src/libstd/par.rs | 12 | ||||
| -rw-r--r-- | src/libstd/serialization.rs | 8 | ||||
| -rw-r--r-- | src/libstd/smallintmap.rs | 20 | ||||
| -rw-r--r-- | src/libstd/sort.rs | 18 | ||||
| -rw-r--r-- | src/libstd/sync.rs | 6 | ||||
| -rw-r--r-- | src/libstd/timer.rs | 4 | ||||
| -rw-r--r-- | src/libstd/treemap.rs | 6 |
15 files changed, 103 insertions, 103 deletions
diff --git a/src/libstd/arc.rs b/src/libstd/arc.rs index b5af4af06c3..fb9a7e7e489 100644 --- a/src/libstd/arc.rs +++ b/src/libstd/arc.rs @@ -69,10 +69,10 @@ impl &Condvar { ****************************************************************************/ /// An atomically reference counted wrapper for shared immutable state. -struct ARC<T: const send> { x: SharedMutableState<T> } +struct ARC<T: Const Send> { x: SharedMutableState<T> } /// Create an atomically reference counted wrapper. -fn ARC<T: const send>(+data: T) -> ARC<T> { +fn ARC<T: Const Send>(+data: T) -> ARC<T> { ARC { x: unsafe { shared_mutable_state(data) } } } @@ -80,7 +80,7 @@ fn ARC<T: const send>(+data: T) -> ARC<T> { * Access the underlying data in an atomically reference counted * wrapper. */ -fn get<T: const send>(rc: &a/ARC<T>) -> &a/T { +fn get<T: Const Send>(rc: &a/ARC<T>) -> &a/T { unsafe { get_shared_immutable_state(&rc.x) } } @@ -91,7 +91,7 @@ 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. */ -fn clone<T: const send>(rc: &ARC<T>) -> ARC<T> { +fn clone<T: Const Send>(rc: &ARC<T>) -> ARC<T> { ARC { x: unsafe { clone_shared_mutable_state(&rc.x) } } } @@ -104,7 +104,7 @@ 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 Send>(+rc: ARC<T>) -> T { let ARC { x: x } = rc; unsafe { unwrap_shared_mutable_state(x) } } @@ -114,19 +114,19 @@ fn unwrap<T: const send>(+rc: ARC<T>) -> T { ****************************************************************************/ #[doc(hidden)] -struct MutexARCInner<T: send> { lock: Mutex, failed: bool, data: T } +struct MutexARCInner<T: Send> { 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: Send> { x: SharedMutableState<MutexARCInner<T>> } /// Create a mutex-protected ARC with the supplied data. -fn MutexARC<T: send>(+user_data: T) -> MutexARC<T> { +fn MutexARC<T: Send>(+user_data: T) -> MutexARC<T> { mutex_arc_with_condvars(user_data, 1) } /** * Create a mutex-protected ARC with the supplied data and a specified number * of condvars (as sync::mutex_with_condvars). */ -fn mutex_arc_with_condvars<T: send>(+user_data: T, +fn mutex_arc_with_condvars<T: Send>(+user_data: T, num_condvars: uint) -> MutexARC<T> { let data = MutexARCInner { lock: mutex_with_condvars(num_condvars), @@ -134,7 +134,7 @@ fn mutex_arc_with_condvars<T: send>(+user_data: T, MutexARC { x: unsafe { shared_mutable_state(data) } } } -impl<T: send> &MutexARC<T> { +impl<T: Send> &MutexARC<T> { /// Duplicate a mutex-protected ARC, as arc::clone. fn clone() -> MutexARC<T> { // NB: Cloning the underlying mutex is not necessary. Its reference @@ -197,7 +197,7 @@ impl<T: send> &MutexARC<T> { * Will additionally fail if another task has failed while accessing the arc. */ // FIXME(#2585) make this a by-move method on the arc -fn unwrap_mutex_arc<T: send>(+arc: MutexARC<T>) -> T { +fn unwrap_mutex_arc<T: Send>(+arc: MutexARC<T>) -> T { let MutexARC { x: x } = arc; let inner = unsafe { unwrap_shared_mutable_state(x) }; let MutexARCInner { failed: failed, data: data, _ } = inner; @@ -240,27 +240,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 Send> { 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 Send> { x: SharedMutableState<RWARCInner<T>>, mut cant_nest: () } /// Create a reader/writer ARC with the supplied data. -fn RWARC<T: const send>(+user_data: T) -> RWARC<T> { +fn RWARC<T: Const Send>(+user_data: T) -> RWARC<T> { rw_arc_with_condvars(user_data, 1) } /** * Create a reader/writer ARC with the supplied data and a specified number * of condvars (as sync::rwlock_with_condvars). */ -fn rw_arc_with_condvars<T: const send>(+user_data: T, +fn rw_arc_with_condvars<T: Const Send>(+user_data: T, num_condvars: uint) -> RWARC<T> { let data = RWARCInner { lock: rwlock_with_condvars(num_condvars), @@ -268,7 +268,7 @@ fn rw_arc_with_condvars<T: const send>(+user_data: T, RWARC { x: unsafe { shared_mutable_state(data) }, cant_nest: () } } -impl<T: const send> &RWARC<T> { +impl<T: Const Send> &RWARC<T> { /// Duplicate a rwlock-protected ARC, as arc::clone. fn clone() -> RWARC<T> { RWARC { x: unsafe { clone_shared_mutable_state(&self.x) }, @@ -375,7 +375,7 @@ impl<T: const send> &RWARC<T> { * in write mode. */ // FIXME(#2585) make this a by-move method on the arc -fn unwrap_rw_arc<T: const send>(+arc: RWARC<T>) -> T { +fn unwrap_rw_arc<T: Const Send>(+arc: RWARC<T>) -> T { let RWARC { x: x, _ } = arc; let inner = unsafe { unwrap_shared_mutable_state(x) }; let RWARCInner { failed: failed, data: data, _ } = inner; @@ -389,19 +389,19 @@ 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 Send>(state: &r/mut RWARCInner<T>) -> &r/RWlock { unsafe { unsafe::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(). -enum RWWriteMode<T: const send> = +enum RWWriteMode<T: Const Send> = (&mut T, sync::RWlockWriteMode, PoisonOnFail); /// The "read permission" token used for RWARC.write_downgrade(). -enum RWReadMode<T:const send> = (&T, sync::RWlockReadMode); +enum RWReadMode<T:Const Send> = (&T, sync::RWlockReadMode); -impl<T: const send> &RWWriteMode<T> { +impl<T: Const Send> &RWWriteMode<T> { /// Access the pre-downgrade RWARC in write mode. fn write<U>(blk: fn(x: &mut T) -> U) -> U { match *self { @@ -427,7 +427,7 @@ impl<T: const send> &RWWriteMode<T> { } } -impl<T: const send> &RWReadMode<T> { +impl<T: Const Send> &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/c_vec.rs b/src/libstd/c_vec.rs index 5b0e9b0ffdd..53964fb0ddb 100644 --- a/src/libstd/c_vec.rs +++ b/src/libstd/c_vec.rs @@ -107,7 +107,7 @@ unsafe fn c_vec_with_dtor<T>(base: *mut T, len: uint, dtor: fn@()) * * Fails if `ofs` is greater or equal to the length of the vector */ -fn get<T: copy>(t: CVec<T>, ofs: uint) -> T { +fn get<T: Copy>(t: CVec<T>, ofs: uint) -> T { assert ofs < len(t); return unsafe { *ptr::mut_offset((*t).base, ofs) }; } @@ -117,7 +117,7 @@ fn get<T: copy>(t: CVec<T>, ofs: uint) -> T { * * Fails if `ofs` is greater or equal to the length of the vector */ -fn set<T: copy>(t: CVec<T>, ofs: uint, v: T) { +fn set<T: Copy>(t: CVec<T>, ofs: uint, v: T) { assert ofs < len(t); unsafe { *ptr::mut_offset((*t).base, ofs) = v }; } diff --git a/src/libstd/comm.rs b/src/libstd/comm.rs index d286b496923..d78e11452bc 100644 --- a/src/libstd/comm.rs +++ b/src/libstd/comm.rs @@ -13,7 +13,7 @@ use pipes::{Channel, Recv, Chan, Port, Selectable}; export DuplexStream; /// An extension of `pipes::stream` that allows both sending and receiving. -struct DuplexStream<T: send, U: send> : Channel<T>, Recv<U>, Selectable { +struct DuplexStream<T: Send, U: Send> : Channel<T>, Recv<U>, Selectable { priv chan: Chan<T>, priv port: Port <U>, @@ -43,7 +43,7 @@ struct DuplexStream<T: send, U: send> : Channel<T>, Recv<U>, Selectable { } /// Creates a bidirectional stream. -fn DuplexStream<T: send, U: send>() +fn DuplexStream<T: Send, U: Send>() -> (DuplexStream<T, U>, DuplexStream<U, T>) { let (c2, p1) = pipes::stream(); diff --git a/src/libstd/deque.rs b/src/libstd/deque.rs index 6cd229bc689..f9def4b2332 100644 --- a/src/libstd/deque.rs +++ b/src/libstd/deque.rs @@ -16,7 +16,7 @@ trait Deque<T> { // FIXME (#2343) eventually, a proper datatype plus an exported impl would // be preferrable. -fn create<T: copy>() -> Deque<T> { +fn create<T: Copy>() -> Deque<T> { type Cell<T> = Option<T>; let initial_capacity: uint = 32u; // 2^5 @@ -24,7 +24,7 @@ fn create<T: copy>() -> Deque<T> { * Grow is only called on full elts, so nelts is also len(elts), unlike * elsewhere. */ - fn grow<T: copy>(nelts: uint, lo: uint, -elts: ~[mut Cell<T>]) -> + fn grow<T: Copy>(nelts: uint, lo: uint, -elts: ~[mut Cell<T>]) -> ~[mut Cell<T>] { assert (nelts == vec::len(elts)); let mut rv = ~[mut]; @@ -40,7 +40,7 @@ fn create<T: copy>() -> Deque<T> { return rv; } - fn get<T: copy>(elts: DVec<Cell<T>>, i: uint) -> T { + fn get<T: Copy>(elts: DVec<Cell<T>>, i: uint) -> T { match elts.get_elt(i) { Some(t) => t, _ => fail } } @@ -49,7 +49,7 @@ fn create<T: copy>() -> Deque<T> { mut hi: uint, elts: DVec<Cell<T>>}; - impl <T: copy> Repr<T>: Deque<T> { + impl <T: Copy> Repr<T>: Deque<T> { fn size() -> uint { return self.nelts; } fn add_front(t: T) { let oldlo: uint = self.lo; @@ -193,7 +193,7 @@ mod tests { type EqFn<T> = fn@(T, T) -> bool; - fn test_parameterized<T: copy owned>( + fn test_parameterized<T: Copy Owned>( e: EqFn<T>, a: T, b: T, c: T, d: T) { let deq: deque::Deque<T> = deque::create::<T>(); diff --git a/src/libstd/fun_treemap.rs b/src/libstd/fun_treemap.rs index e7a92e5d8cc..3761b511402 100644 --- a/src/libstd/fun_treemap.rs +++ b/src/libstd/fun_treemap.rs @@ -33,7 +33,7 @@ enum TreeNode<K, V> { fn init<K, V>() -> Treemap<K, V> { @Empty } /// Insert a value into the map -fn insert<K: copy Eq Ord, V: copy>(m: Treemap<K, V>, +k: K, +v: V) +fn insert<K: Copy Eq Ord, V: Copy>(m: Treemap<K, V>, +k: K, +v: V) -> Treemap<K, V> { @match m { @Empty => Node(@k, @v, @Empty, @Empty), @@ -48,7 +48,7 @@ fn insert<K: copy Eq Ord, V: copy>(m: Treemap<K, V>, +k: K, +v: V) } /// Find a value based on the key -fn find<K: Eq Ord, V: copy>(m: Treemap<K, V>, +k: K) -> Option<V> { +fn find<K: Eq Ord, V: Copy>(m: Treemap<K, V>, +k: K) -> Option<V> { match *m { Empty => None, Node(@kk, @v, left, right) => { @@ -60,7 +60,7 @@ fn find<K: Eq Ord, V: copy>(m: Treemap<K, V>, +k: K) -> Option<V> { } /// Visit all pairs in the map in order. -fn traverse<K, V: copy>(m: Treemap<K, V>, f: fn(K, V)) { +fn traverse<K, V: Copy>(m: Treemap<K, V>, f: fn(K, V)) { match *m { Empty => (), /* diff --git a/src/libstd/json.rs b/src/libstd/json.rs index f2207f2a913..1adb41e8d10 100644 --- a/src/libstd/json.rs +++ b/src/libstd/json.rs @@ -720,7 +720,7 @@ impl <A: ToJson> ~[A]: ToJson { fn to_json() -> Json { List(@self.map(|elt| elt.to_json())) } } -impl <A: ToJson copy> hashmap<~str, A>: ToJson { +impl <A: ToJson Copy> hashmap<~str, A>: ToJson { fn to_json() -> Json { let d = map::str_hash(); for self.each() |key, value| { diff --git a/src/libstd/list.rs b/src/libstd/list.rs index 71b820b4022..96d4e32d02b 100644 --- a/src/libstd/list.rs +++ b/src/libstd/list.rs @@ -13,7 +13,7 @@ enum List<T> { } /// Cregate a list from a vector -fn from_vec<T: copy>(v: &[T]) -> @List<T> { +fn from_vec<T: Copy>(v: &[T]) -> @List<T> { vec::foldr(v, @Nil::<T>, |h, t| @Cons(h, t)) } @@ -30,7 +30,7 @@ fn from_vec<T: copy>(v: &[T]) -> @List<T> { * * z - The initial value * * f - The function to apply */ -fn foldl<T: copy, U>(+z: T, ls: @List<U>, f: fn((&T), (&U)) -> T) -> T { +fn foldl<T: Copy, U>(+z: T, ls: @List<U>, f: fn((&T), (&U)) -> T) -> T { let mut accum: T = z; do iter(ls) |elt| { accum = f(&accum, &elt);} accum @@ -43,7 +43,7 @@ fn foldl<T: copy, U>(+z: T, ls: @List<U>, f: fn((&T), (&U)) -> T) -> T { * When function `f` returns true then an option containing the element * is returned. If `f` matches no elements then none is returned. */ -fn find<T: copy>(ls: @List<T>, f: fn((&T)) -> bool) -> Option<T> { +fn find<T: Copy>(ls: @List<T>, f: fn((&T)) -> bool) -> Option<T> { let mut ls = ls; loop { ls = match *ls { @@ -57,7 +57,7 @@ fn find<T: copy>(ls: @List<T>, f: fn((&T)) -> bool) -> Option<T> { } /// Returns true if a list contains an element with the given value -fn has<T: copy Eq>(ls: @List<T>, +elt: T) -> bool { +fn has<T: Copy Eq>(ls: @List<T>, +elt: T) -> bool { for each(ls) |e| { if e == elt { return true; } } @@ -65,7 +65,7 @@ fn has<T: copy Eq>(ls: @List<T>, +elt: T) -> bool { } /// Returns true if the list is empty -pure fn is_empty<T: copy>(ls: @List<T>) -> bool { +pure fn is_empty<T: Copy>(ls: @List<T>) -> bool { match *ls { Nil => true, _ => false @@ -73,7 +73,7 @@ pure fn is_empty<T: copy>(ls: @List<T>) -> bool { } /// Returns true if the list is not empty -pure fn is_not_empty<T: copy>(ls: @List<T>) -> bool { +pure fn is_not_empty<T: Copy>(ls: @List<T>) -> bool { return !is_empty(ls); } @@ -85,7 +85,7 @@ fn len<T>(ls: @List<T>) -> uint { } /// Returns all but the first element of a list -pure fn tail<T: copy>(ls: @List<T>) -> @List<T> { +pure fn tail<T: Copy>(ls: @List<T>) -> @List<T> { match *ls { Cons(_, tl) => return tl, Nil => fail ~"list empty" @@ -93,7 +93,7 @@ pure fn tail<T: copy>(ls: @List<T>) -> @List<T> { } /// Returns the first element of a list -pure fn head<T: copy>(ls: @List<T>) -> T { +pure fn head<T: Copy>(ls: @List<T>) -> T { match *ls { Cons(hd, _) => hd, // makes me sad @@ -102,7 +102,7 @@ pure fn head<T: copy>(ls: @List<T>) -> T { } /// Appends one list to another -pure fn append<T: copy>(l: @List<T>, m: @List<T>) -> @List<T> { +pure fn append<T: Copy>(l: @List<T>, m: @List<T>) -> @List<T> { match *l { Nil => return m, Cons(x, xs) => { @@ -115,7 +115,7 @@ pure fn append<T: copy>(l: @List<T>, m: @List<T>) -> @List<T> { /* /// Push one element into the front of a list, returning a new list /// THIS VERSION DOESN'T ACTUALLY WORK -pure fn push<T: copy>(ll: &mut @list<T>, +vv: T) { +pure fn push<T: Copy>(ll: &mut @list<T>, +vv: T) { ll = &mut @cons(vv, *ll) } */ diff --git a/src/libstd/map.rs b/src/libstd/map.rs index 603cff98721..5436ea1a803 100644 --- a/src/libstd/map.rs +++ b/src/libstd/map.rs @@ -24,7 +24,7 @@ type set<K:Eq IterBytes Hash> = hashmap<K, ()>; type hashmap<K:Eq IterBytes Hash, V> = chained::t<K, V>; -trait map<K:Eq IterBytes Hash copy, V: copy> { +trait map<K:Eq IterBytes Hash Copy, V: Copy> { /// Return the number of elements in the map pure fn size() -> uint; @@ -123,7 +123,7 @@ mod chained { found_after(@entry<K,V>, @entry<K,V>) } - priv impl<K:Eq IterBytes Hash, V: copy> t<K, V> { + priv impl<K:Eq IterBytes Hash, V: Copy> t<K, V> { pure fn search_rem(k: &K, h: uint, idx: uint, e_root: @entry<K,V>) -> search_result<K,V> { let mut e0 = e_root; @@ -207,7 +207,7 @@ mod chained { } } - impl<K:Eq IterBytes Hash copy, V: copy> t<K, V>: map<K, V> { + impl<K:Eq IterBytes Hash Copy, V: Copy> t<K, V>: map<K, V> { pure fn size() -> uint { self.count } fn contains_key(+k: K) -> bool { @@ -330,7 +330,7 @@ mod chained { } } - impl<K:Eq IterBytes Hash copy ToStr, V: ToStr copy> t<K, V>: ToStr { + impl<K:Eq IterBytes Hash Copy ToStr, V: ToStr Copy> t<K, V>: ToStr { fn to_writer(wr: io::Writer) { if self.count == 0u { wr.write_str(~"{}"); @@ -356,7 +356,7 @@ mod chained { } } - impl<K:Eq IterBytes Hash copy, V: copy> t<K, V>: ops::Index<K, V> { + impl<K:Eq IterBytes Hash Copy, V: Copy> t<K, V>: ops::Index<K, V> { pure fn index(&&k: K) -> V { unchecked { self.get(k) @@ -368,7 +368,7 @@ mod chained { vec::to_mut(vec::from_elem(nchains, None)) } - fn mk<K:Eq IterBytes Hash, V: copy>() -> t<K,V> { + fn mk<K:Eq IterBytes Hash, V: Copy>() -> t<K,V> { let slf: t<K, V> = @hashmap_ {count: 0u, chains: chains(initial_capacity)}; slf @@ -380,48 +380,48 @@ Function: hashmap Construct a hashmap. */ -fn hashmap<K:Eq IterBytes Hash const, V: copy>() +fn hashmap<K:Eq IterBytes Hash Const, V: Copy>() -> hashmap<K, V> { chained::mk() } /// Construct a hashmap for string-slice keys -fn str_slice_hash<V: copy>() -> hashmap<&str, V> { +fn str_slice_hash<V: Copy>() -> hashmap<&str, V> { return hashmap(); } /// Construct a hashmap for string keys -fn str_hash<V: copy>() -> hashmap<~str, V> { +fn str_hash<V: Copy>() -> hashmap<~str, V> { return hashmap(); } /// Construct a hashmap for boxed string keys -fn box_str_hash<V: copy>() -> hashmap<@~str, V> { +fn box_str_hash<V: Copy>() -> hashmap<@~str, V> { hashmap() } /// Construct a hashmap for byte string keys -fn bytes_hash<V: copy>() -> hashmap<~[u8], V> { +fn bytes_hash<V: Copy>() -> hashmap<~[u8], V> { return hashmap(); } /// Construct a hashmap for int keys -fn int_hash<V: copy>() -> hashmap<int, V> { +fn int_hash<V: Copy>() -> hashmap<int, V> { return hashmap(); } /// Construct a hashmap for uint keys -fn uint_hash<V: copy>() -> hashmap<uint, V> { +fn uint_hash<V: Copy>() -> hashmap<uint, V> { return hashmap(); } /// Convenience function for adding keys to a hashmap with nil type keys -fn set_add<K:Eq IterBytes Hash const copy>(set: set<K>, +key: K) -> bool { +fn set_add<K:Eq IterBytes Hash Const Copy>(set: set<K>, +key: K) -> bool { set.insert(key, ()) } /// Convert a set into a vector. -fn vec_from_set<T:Eq IterBytes Hash copy>(s: set<T>) -> ~[T] { +fn vec_from_set<T:Eq IterBytes Hash Copy>(s: set<T>) -> ~[T] { let mut v = ~[]; vec::reserve(v, s.size()); do s.each_key() |k| { @@ -432,7 +432,7 @@ fn vec_from_set<T:Eq IterBytes Hash copy>(s: set<T>) -> ~[T] { } /// Construct a hashmap from a vector -fn hash_from_vec<K: Eq IterBytes Hash const copy, V: copy>( +fn hash_from_vec<K: Eq IterBytes Hash Const Copy, V: Copy>( items: &[(K, V)]) -> hashmap<K, V> { let map = hashmap(); do vec::iter(items) |item| { @@ -443,27 +443,27 @@ fn hash_from_vec<K: Eq IterBytes Hash const copy, V: copy>( } /// Construct a hashmap from a vector with string keys -fn hash_from_strs<V: copy>(items: &[(~str, V)]) -> hashmap<~str, V> { +fn hash_from_strs<V: Copy>(items: &[(~str, V)]) -> hashmap<~str, V> { hash_from_vec(items) } /// Construct a hashmap from a vector with byte keys -fn hash_from_bytes<V: copy>(items: &[(~[u8], V)]) -> hashmap<~[u8], V> { +fn hash_from_bytes<V: Copy>(items: &[(~[u8], V)]) -> hashmap<~[u8], V> { hash_from_vec(items) } /// Construct a hashmap from a vector with int keys -fn hash_from_ints<V: copy>(items: &[(int, V)]) -> hashmap<int, V> { +fn hash_from_ints<V: Copy>(items: &[(int, V)]) -> hashmap<int, V> { hash_from_vec(items) } /// Construct a hashmap from a vector with uint keys -fn hash_from_uints<V: copy>(items: &[(uint, V)]) -> hashmap<uint, V> { +fn hash_from_uints<V: Copy>(items: &[(uint, V)]) -> hashmap<uint, V> { hash_from_vec(items) } // XXX Transitional -impl<K: Eq IterBytes Hash copy, V: copy> Managed<LinearMap<K, V>>: +impl<K: Eq IterBytes Hash Copy, V: Copy> Managed<LinearMap<K, V>>: map<K, V> { pure fn size() -> uint { unchecked { diff --git a/src/libstd/par.rs b/src/libstd/par.rs index 1735765a474..d6e498c0a23 100644 --- a/src/libstd/par.rs +++ b/src/libstd/par.rs @@ -18,7 +18,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 Send, B: Copy Send>( xs: &[A], f: fn() -> fn~(uint, v: &[A]) -> B) -> ~[B] { @@ -73,7 +73,7 @@ fn map_slices<A: copy send, B: copy send>( } /// A parallel version of map. -fn map<A: copy send, B: copy send>(xs: ~[A], f: fn~(A) -> B) -> ~[B] { +fn map<A: Copy Send, B: Copy Send>(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)) @@ -82,7 +82,7 @@ fn map<A: copy send, B: copy send>(xs: ~[A], f: fn~(A) -> B) -> ~[B] { } /// A parallel version of mapi. -fn mapi<A: copy send, B: copy send>(xs: ~[A], +fn mapi<A: Copy Send, B: Copy Send>(xs: ~[A], f: fn~(uint, A) -> B) -> ~[B] { let slices = map_slices(xs, || { fn~(base: uint, slice : &[A], copy f) -> ~[B] { @@ -103,7 +103,7 @@ 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. */ -fn mapi_factory<A: copy send, B: copy send>( +fn mapi_factory<A: Copy Send, B: Copy Send>( xs: &[A], f: fn() -> fn~(uint, A) -> B) -> ~[B] { let slices = map_slices(xs, || { let f = f(); @@ -120,7 +120,7 @@ fn mapi_factory<A: copy send, B: copy send>( } /// Returns true if the function holds for all elements in the vector. -fn alli<A: copy send>(xs: ~[A], f: fn~(uint, A) -> bool) -> bool { +fn alli<A: Copy Send>(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| { @@ -131,7 +131,7 @@ 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. -fn any<A: copy send>(xs: ~[A], f: fn~(A) -> bool) -> bool { +fn any<A: Copy Send>(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/serialization.rs b/src/libstd/serialization.rs index 411d18b72fc..743e2fc2bf1 100644 --- a/src/libstd/serialization.rs +++ b/src/libstd/serialization.rs @@ -93,7 +93,7 @@ fn emit_from_vec<S: serializer, T>(s: S, v: ~[T], f: fn(T)) { } } -fn read_to_vec<D: deserializer, T: copy>(d: D, f: fn() -> T) -> ~[T] { +fn read_to_vec<D: deserializer, T: Copy>(d: D, f: fn() -> T) -> ~[T] { do d.read_vec |len| { do vec::from_fn(len) |i| { d.read_vec_elt(i, || f()) @@ -112,11 +112,11 @@ impl<S: serializer> S: serializer_helpers { } trait deserializer_helpers { - fn read_to_vec<T: copy>(f: fn() -> T) -> ~[T]; + fn read_to_vec<T: Copy>(f: fn() -> T) -> ~[T]; } impl<D: deserializer> D: deserializer_helpers { - fn read_to_vec<T: copy>(f: fn() -> T) -> ~[T] { + fn read_to_vec<T: Copy>(f: fn() -> T) -> ~[T] { read_to_vec(self, f) } } @@ -256,7 +256,7 @@ fn serialize_Option<S: serializer,T>(s: S, v: Option<T>, st: fn(T)) { } } -fn deserialize_Option<D: deserializer,T: copy>(d: D, st: fn() -> T) +fn deserialize_Option<D: deserializer,T: Copy>(d: D, st: fn() -> T) -> Option<T> { do d.read_enum(~"option") { do d.read_enum_variant |i| { diff --git a/src/libstd/smallintmap.rs b/src/libstd/smallintmap.rs index 25cb53f7eaa..a65d41a2d32 100644 --- a/src/libstd/smallintmap.rs +++ b/src/libstd/smallintmap.rs @@ -12,14 +12,14 @@ use map::map; // FIXME (#2347): Should not be @; there's a bug somewhere in rustc that // requires this to be. -type SmallIntMap_<T: copy> = {v: DVec<Option<T>>}; +type SmallIntMap_<T: Copy> = {v: DVec<Option<T>>}; -enum SmallIntMap<T:copy> { +enum SmallIntMap<T:Copy> { SmallIntMap_(@SmallIntMap_<T>) } /// Create a smallintmap -fn mk<T: copy>() -> SmallIntMap<T> { +fn mk<T: Copy>() -> SmallIntMap<T> { let v = DVec(); return SmallIntMap_(@{v: v}); } @@ -29,7 +29,7 @@ fn mk<T: copy>() -> SmallIntMap<T> { * the specified key then the original value is replaced. */ #[inline(always)] -fn insert<T: copy>(self: SmallIntMap<T>, key: uint, +val: T) { +fn insert<T: Copy>(self: SmallIntMap<T>, key: uint, +val: T) { //io::println(fmt!("%?", key)); self.v.grow_set_elt(key, None, Some(val)); } @@ -38,7 +38,7 @@ fn insert<T: copy>(self: SmallIntMap<T>, key: uint, +val: T) { * Get the value for the specified key. If the key does not exist * in the map then returns none */ -pure fn find<T: copy>(self: SmallIntMap<T>, key: uint) -> Option<T> { +pure fn find<T: Copy>(self: SmallIntMap<T>, key: uint) -> Option<T> { if key < self.v.len() { return self.v.get_elt(key); } return None::<T>; } @@ -50,7 +50,7 @@ pure fn find<T: copy>(self: SmallIntMap<T>, key: uint) -> Option<T> { * * If the key does not exist in the map */ -pure fn get<T: copy>(self: SmallIntMap<T>, key: uint) -> T { +pure fn get<T: Copy>(self: SmallIntMap<T>, key: uint) -> T { match find(self, key) { None => { error!("smallintmap::get(): key not present"); @@ -61,12 +61,12 @@ pure fn get<T: copy>(self: SmallIntMap<T>, key: uint) -> T { } /// Returns true if the map contains a value for the specified key -fn contains_key<T: copy>(self: SmallIntMap<T>, key: uint) -> bool { +fn contains_key<T: Copy>(self: SmallIntMap<T>, key: uint) -> bool { return !option::is_none(find(self, key)); } /// Implements the map::map interface for smallintmap -impl<V: copy> SmallIntMap<V>: map::map<uint, V> { +impl<V: Copy> SmallIntMap<V>: map::map<uint, V> { pure fn size() -> uint { let mut sz = 0u; for self.v.each |item| { @@ -137,7 +137,7 @@ impl<V: copy> SmallIntMap<V>: map::map<uint, V> { } } -impl<V: copy> SmallIntMap<V>: ops::Index<uint, V> { +impl<V: Copy> SmallIntMap<V>: ops::Index<uint, V> { pure fn index(&&key: uint) -> V { unchecked { get(self, key) @@ -146,6 +146,6 @@ impl<V: copy> SmallIntMap<V>: ops::Index<uint, V> { } /// Cast the given smallintmap to a map::map -fn as_map<V: copy>(s: SmallIntMap<V>) -> map::map<uint, V> { +fn as_map<V: Copy>(s: SmallIntMap<V>) -> map::map<uint, V> { s as map::map::<uint, V> } diff --git a/src/libstd/sort.rs b/src/libstd/sort.rs index 64ea19d35f9..488ae16c751 100644 --- a/src/libstd/sort.rs +++ b/src/libstd/sort.rs @@ -19,12 +19,12 @@ type Le<T> = pure fn(v1: &T, v2: &T) -> bool; * Has worst case O(n log n) performance, best case O(n), but * is not space efficient. This is a stable sort. */ -fn merge_sort<T: copy>(le: Le<T>, v: &[const T]) -> ~[T] { +fn merge_sort<T: Copy>(le: Le<T>, v: &[const T]) -> ~[T] { type Slice = (uint, uint); return merge_sort_(le, v, (0u, len(v))); - fn merge_sort_<T: copy>(le: Le<T>, v: &[const T], slice: Slice) + fn merge_sort_<T: Copy>(le: Le<T>, v: &[const T], slice: Slice) -> ~[T] { let begin = slice.first(); let end = slice.second(); @@ -39,7 +39,7 @@ fn merge_sort<T: copy>(le: Le<T>, v: &[const T]) -> ~[T] { return merge(le, merge_sort_(le, v, a), merge_sort_(le, v, b)); } - fn merge<T: copy>(le: Le<T>, a: &[T], b: &[T]) -> ~[T] { + fn merge<T: Copy>(le: Le<T>, a: &[T], b: &[T]) -> ~[T] { let mut rs = ~[]; vec::reserve(rs, len(a) + len(b)); let a_len = len(a); @@ -58,7 +58,7 @@ fn merge_sort<T: copy>(le: Le<T>, v: &[const T]) -> ~[T] { } } -fn part<T: copy>(compare_func: Le<T>, arr: &[mut T], left: uint, +fn part<T: Copy>(compare_func: Le<T>, arr: &[mut T], left: uint, right: uint, pivot: uint) -> uint { let pivot_value = arr[pivot]; arr[pivot] <-> arr[right]; @@ -75,7 +75,7 @@ fn part<T: copy>(compare_func: Le<T>, arr: &[mut T], left: uint, return storage_index; } -fn qsort<T: copy>(compare_func: Le<T>, arr: &[mut T], left: uint, +fn qsort<T: Copy>(compare_func: Le<T>, arr: &[mut T], left: uint, right: uint) { if right > left { let pivot = (left + right) / 2u; @@ -94,12 +94,12 @@ fn qsort<T: copy>(compare_func: Le<T>, arr: &[mut T], left: uint, * Has worst case O(n^2) performance, average case O(n log n). * This is an unstable sort. */ -fn quick_sort<T: copy>(compare_func: Le<T>, arr: &[mut T]) { +fn quick_sort<T: Copy>(compare_func: Le<T>, arr: &[mut T]) { if len::<T>(arr) == 0u { return; } qsort::<T>(compare_func, arr, 0u, len::<T>(arr) - 1u); } -fn qsort3<T: copy Ord Eq>(arr: &[mut T], left: int, right: int) { +fn qsort3<T: Copy Ord Eq>(arr: &[mut T], left: int, right: int) { if right <= left { return; } let v: T = arr[right]; let mut i: int = left - 1; @@ -156,7 +156,7 @@ fn qsort3<T: copy Ord Eq>(arr: &[mut T], left: int, right: int) { * * This is an unstable sort. */ -fn quick_sort3<T: copy Ord Eq>(arr: &[mut T]) { +fn quick_sort3<T: Copy Ord Eq>(arr: &[mut T]) { if arr.len() <= 1 { return; } qsort3(arr, 0, (arr.len() - 1) as int); } @@ -165,7 +165,7 @@ trait Sort { fn qsort(self); } -impl<T: copy Ord Eq> &[mut T] : Sort { +impl<T: Copy Ord Eq> &[mut T] : Sort { fn qsort(self) { quick_sort3(self); } } diff --git a/src/libstd/sync.rs b/src/libstd/sync.rs index 45ab8d4c427..986a6e05225 100644 --- a/src/libstd/sync.rs +++ b/src/libstd/sync.rs @@ -70,10 +70,10 @@ struct SemInner<Q> { blocked: Q } #[doc(hidden)] -enum Sem<Q: send> = Exclusive<SemInner<Q>>; +enum Sem<Q: Send> = Exclusive<SemInner<Q>>; #[doc(hidden)] -fn new_sem<Q: send>(count: int, +q: Q) -> Sem<Q> { +fn new_sem<Q: Send>(count: int, +q: Q) -> Sem<Q> { Sem(exclusive(SemInner { mut count: count, waiters: new_waitqueue(), blocked: q })) } @@ -88,7 +88,7 @@ fn new_sem_and_signal(count: int, num_condvars: uint) } #[doc(hidden)] -impl<Q: send> &Sem<Q> { +impl<Q: Send> &Sem<Q> { fn acquire() { let mut waiter_nobe = None; unsafe { diff --git a/src/libstd/timer.rs b/src/libstd/timer.rs index 25bc5e58c4e..bda489c3ba7 100644 --- a/src/libstd/timer.rs +++ b/src/libstd/timer.rs @@ -26,7 +26,7 @@ export delayed_send, sleep, recv_timeout; * * ch - a channel of type T to send a `val` on * * val - a value of type T to send over the provided `ch` */ -fn delayed_send<T: copy send>(iotask: IoTask, +fn delayed_send<T: Copy Send>(iotask: IoTask, msecs: uint, ch: comm::Chan<T>, +val: T) { unsafe { let timer_done_po = core::comm::Port::<()>(); @@ -102,7 +102,7 @@ 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. */ -fn recv_timeout<T: copy send>(iotask: IoTask, +fn recv_timeout<T: Copy Send>(iotask: IoTask, msecs: uint, wait_po: comm::Port<T>) -> Option<T> { let timeout_po = comm::Port::<()>(); diff --git a/src/libstd/treemap.rs b/src/libstd/treemap.rs index 9d6c8dade61..a43821a0d37 100644 --- a/src/libstd/treemap.rs +++ b/src/libstd/treemap.rs @@ -32,7 +32,7 @@ enum TreeNode<K, V> = { fn TreeMap<K, V>() -> TreeMap<K, V> { @mut None } /// Insert a value into the map -fn insert<K: copy Eq Ord, V: copy>(m: &mut TreeEdge<K, V>, +k: K, +v: V) { +fn insert<K: Copy Eq Ord, V: Copy>(m: &mut TreeEdge<K, V>, +k: K, +v: V) { match copy *m { None => { *m = Some(@TreeNode({key: k, @@ -54,7 +54,7 @@ fn insert<K: copy Eq Ord, V: copy>(m: &mut TreeEdge<K, V>, +k: K, +v: V) { } /// Find a value based on the key -fn find<K: copy Eq Ord, V: copy>(m: &const TreeEdge<K, V>, +k: K) +fn find<K: Copy Eq Ord, V: Copy>(m: &const TreeEdge<K, V>, +k: K) -> Option<V> { match copy *m { None => None, @@ -73,7 +73,7 @@ fn find<K: copy Eq Ord, V: copy>(m: &const TreeEdge<K, V>, +k: K) } /// Visit all pairs in the map in order. -fn traverse<K, V: copy>(m: &const TreeEdge<K, V>, f: fn(K, V)) { +fn traverse<K, V: Copy>(m: &const TreeEdge<K, V>, f: fn(K, V)) { match copy *m { None => (), Some(node) => { |
