about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorMarijn Haverbeke <marijnh@gmail.com>2012-01-05 15:35:37 +0100
committerMarijn Haverbeke <marijnh@gmail.com>2012-01-05 15:50:02 +0100
commit60ae1590af034755b5cb1e1e71f2240a710299a2 (patch)
tree605d11f071a776c0ca33dcfea0a774379b0880bb /src/libstd
parent1f71a0f48d18d80ff3be6970d582c5a67f976329 (diff)
downloadrust-60ae1590af034755b5cb1e1e71f2240a710299a2.tar.gz
rust-60ae1590af034755b5cb1e1e71f2240a710299a2.zip
Switch to new param kind bound syntax
And remove support for the old syntax
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/c_vec.rs4
-rw-r--r--src/libstd/comm.rs20
-rw-r--r--src/libstd/deque.rs8
-rw-r--r--src/libstd/fun_treemap.rs6
-rw-r--r--src/libstd/list.rs18
-rw-r--r--src/libstd/map.rs41
-rw-r--r--src/libstd/smallintmap.rs10
-rw-r--r--src/libstd/sort.rs14
-rw-r--r--src/libstd/test.rs14
-rw-r--r--src/libstd/treemap.rs4
-rw-r--r--src/libstd/util.rs2
11 files changed, 71 insertions, 70 deletions
diff --git a/src/libstd/c_vec.rs b/src/libstd/c_vec.rs
index 7c2f1be7084..4374a7ffb99 100644
--- a/src/libstd/c_vec.rs
+++ b/src/libstd/c_vec.rs
@@ -108,7 +108,7 @@ Failure:
 
 If `ofs` is greater or equal to the length of the vector
 */
-fn get<copy T>(t: t<T>, ofs: uint) -> T {
+fn get<T: copy>(t: t<T>, ofs: uint) -> T {
     assert ofs < (*t).size;
     ret unsafe { *ptr::mut_offset((*t).base, ofs) };
 }
@@ -122,7 +122,7 @@ Failure:
 
 If `ofs` is greater or equal to the length of the vector
 */
-fn set<copy T>(t: t<T>, ofs: uint, v: T) {
+fn set<T: copy>(t: t<T>, ofs: uint, v: T) {
     assert ofs < (*t).size;
     unsafe { *ptr::mut_offset((*t).base, ofs) = v };
 }
diff --git a/src/libstd/comm.rs b/src/libstd/comm.rs
index aee8beba111..86aeed3826c 100644
--- a/src/libstd/comm.rs
+++ b/src/libstd/comm.rs
@@ -41,7 +41,7 @@ native mod rustrt {
     type void;
     type rust_port;
 
-    fn chan_id_send<send T>(t: *sys::type_desc,
+    fn chan_id_send<T: send>(t: *sys::type_desc,
                             target_task: task::task, target_port: port_id,
                             data: T) -> ctypes::uintptr_t;
 
@@ -57,7 +57,7 @@ native mod rustrt {
 
 #[abi = "rust-intrinsic"]
 native mod rusti {
-    fn call_with_retptr<send T>(&&f: fn@(*uint)) -> T;
+    fn call_with_retptr<T: send>(&&f: fn@(*uint)) -> T;
 }
 
 type port_id = int;
@@ -80,11 +80,11 @@ dropped.
 
 Channels may be duplicated and themselves transmitted over other channels.
 */
-tag chan<send T> {
+tag chan<T: send> {
     chan_t(task::task, port_id);
 }
 
-resource port_ptr<send T>(po: *rustrt::rust_port) {
+resource port_ptr<T: send>(po: *rustrt::rust_port) {
     // Once the port is detached it's guaranteed not to receive further
     // messages
     rustrt::rust_port_detach(po);
@@ -108,7 +108,7 @@ transmitted. If a port value is copied, both copies refer to the same port.
 
 Ports may be associated with multiple <chan>s.
 */
-tag port<send T> { port_t(@port_ptr<T>); }
+tag port<T: send> { port_t(@port_ptr<T>); }
 
 /*
 Function: send
@@ -118,7 +118,7 @@ Sends data over a channel.
 The sent data is moved into the channel, whereupon the caller loses access
 to it.
 */
-fn send<send T>(ch: chan<T>, -data: T) {
+fn send<T: send>(ch: chan<T>, -data: T) {
     let chan_t(t, p) = ch;
     let res = rustrt::chan_id_send(sys::get_type_desc::<T>(), t, p, data);
     if res != 0u unsafe {
@@ -133,7 +133,7 @@ Function: port
 
 Constructs a port.
 */
-fn port<send T>() -> port<T> {
+fn port<T: send>() -> port<T> {
     port_t(@port_ptr(rustrt::new_port(sys::size_of::<T>())))
 }
 
@@ -145,10 +145,10 @@ Receive from a port.
 If no data is available on the port then the task will block until data
 becomes available.
 */
-fn recv<send T>(p: port<T>) -> T { recv_(***p) }
+fn recv<T: send>(p: port<T>) -> T { recv_(***p) }
 
 // Receive on a raw port pointer
-fn recv_<send T>(p: *rustrt::rust_port) -> T {
+fn recv_<T: send>(p: *rustrt::rust_port) -> T {
     // FIXME: Due to issue 1185 we can't use a return pointer when
     // calling C code, and since we can't create our own return
     // pointer on the stack, we're going to call a little intrinsic
@@ -181,6 +181,6 @@ Constructs a channel.
 
 The channel is bound to the port used to construct it.
 */
-fn chan<send T>(p: port<T>) -> chan<T> {
+fn chan<T: send>(p: port<T>) -> chan<T> {
     chan_t(task::get_task(), rustrt::get_port_id(***p))
 }
diff --git a/src/libstd/deque.rs b/src/libstd/deque.rs
index 8da26c55b10..05c3c6c2b0a 100644
--- a/src/libstd/deque.rs
+++ b/src/libstd/deque.rs
@@ -33,7 +33,7 @@ Section: Functions
 /*
 Function: create
 */
-fn create<copy T>() -> t<T> {
+fn create<T: copy>() -> t<T> {
     type cell<T> = option::t<T>;
 
     let initial_capacity: uint = 32u; // 2^5
@@ -41,7 +41,7 @@ fn create<copy T>() -> t<T> {
       * Grow is only called on full elts, so nelts is also len(elts), unlike
       * elsewhere.
       */
-    fn grow<copy T>(nelts: uint, lo: uint, elts: [mutable cell<T>]) ->
+    fn grow<T: copy>(nelts: uint, lo: uint, elts: [mutable cell<T>]) ->
        [mutable cell<T>] {
         assert (nelts == vec::len(elts));
         let rv = [mutable];
@@ -57,10 +57,10 @@ fn create<copy T>() -> t<T> {
 
         ret rv;
     }
-    fn get<copy T>(elts: [mutable cell<T>], i: uint) -> T {
+    fn get<T: copy>(elts: [mutable cell<T>], i: uint) -> T {
         ret alt elts[i] { option::some(t) { t } _ { fail } };
     }
-    obj deque<copy T>(mutable nelts: uint,
+    obj deque<T: copy>(mutable nelts: uint,
                       mutable lo: uint,
                       mutable hi: uint,
                       mutable elts: [mutable cell<T>]) {
diff --git a/src/libstd/fun_treemap.rs b/src/libstd/fun_treemap.rs
index 1f4e6b9491a..046f565577a 100644
--- a/src/libstd/fun_treemap.rs
+++ b/src/libstd/fun_treemap.rs
@@ -50,7 +50,7 @@ Function: insert
 
 Insert a value into the map
 */
-fn insert<copy K, copy V>(m: treemap<K, V>, k: K, v: V) -> treemap<K, V> {
+fn insert<K: copy, V: copy>(m: treemap<K, V>, k: K, v: V) -> treemap<K, V> {
     @alt m {
        @empty. { node(@k, @v, @empty, @empty) }
        @node(@kk, vv, left, right) {
@@ -68,7 +68,7 @@ Function: find
 
 Find a value based on the key
 */
-fn find<K, copy V>(m: treemap<K, V>, k: K) -> option<V> {
+fn find<K, V: copy>(m: treemap<K, V>, k: K) -> option<V> {
     alt *m {
       empty. { none }
       node(@kk, @v, left, right) {
@@ -84,7 +84,7 @@ Function: traverse
 
 Visit all pairs in the map in order.
 */
-fn traverse<K, copy V>(m: treemap<K, V>, f: block(K, V)) {
+fn traverse<K, V: copy>(m: treemap<K, V>, f: block(K, V)) {
     alt *m {
       empty. { }
       node(@k, @v, _, _) {
diff --git a/src/libstd/list.rs b/src/libstd/list.rs
index aabc3499385..efd633467ef 100644
--- a/src/libstd/list.rs
+++ b/src/libstd/list.rs
@@ -27,7 +27,7 @@ Function: from_vec
 
 Create a list from a vector
 */
-fn from_vec<copy T>(v: [const T]) -> list<T> {
+fn from_vec<T: copy>(v: [const T]) -> list<T> {
     *vec::foldr(v, @nil::<T>, { |h, t| @cons(h, t) })
 }
 
@@ -46,7 +46,7 @@ ls - The list to fold
 z - The initial value
 f - The function to apply
 */
-fn foldl<copy T, U>(ls: list<U>, z: T, f: block(T, U) -> T) -> T {
+fn foldl<T: copy, U>(ls: list<U>, z: T, f: block(T, U) -> T) -> T {
     let accum: T = z;
     iter(ls) {|elt| accum = f(accum, elt);}
     accum
@@ -61,7 +61,7 @@ Apply function `f` to each element of `v`, starting from the first.
 When function `f` returns true then an option containing the element
 is returned. If `f` matches no elements then none is returned.
 */
-fn find<copy T, copy U>(ls: list<T>, f: block(T) -> option::t<U>)
+fn find<T: copy, U: copy>(ls: list<T>, f: block(T) -> option::t<U>)
     -> option::t<U> {
     let ls = ls;
     while true {
@@ -80,7 +80,7 @@ Function: has
 
 Returns true if a list contains an element with the given value
 */
-fn has<copy T>(ls: list<T>, elt: T) -> bool {
+fn has<T: copy>(ls: list<T>, elt: T) -> bool {
     let ls = ls;
     while true {
         alt ls {
@@ -96,7 +96,7 @@ Function: is_empty
 
 Returns true if the list is empty.
 */
-pure fn is_empty<copy T>(ls: list<T>) -> bool {
+pure fn is_empty<T: copy>(ls: list<T>) -> bool {
     alt ls {
         nil. { true }
         _ { false }
@@ -108,7 +108,7 @@ Function: is_not_empty
 
 Returns true if the list is not empty.
 */
-pure fn is_not_empty<copy T>(ls: list<T>) -> bool {
+pure fn is_not_empty<T: copy>(ls: list<T>) -> bool {
     ret !is_empty(ls);
 }
 
@@ -128,7 +128,7 @@ Function: tail
 
 Returns all but the first element of a list
 */
-pure fn tail<copy T>(ls: list<T>) : is_not_empty(ls) -> list<T> {
+pure fn tail<T: copy>(ls: list<T>) : is_not_empty(ls) -> list<T> {
     alt ls {
         cons(_, tl) { ret *tl; }
         nil. { fail "list empty" }
@@ -140,7 +140,7 @@ Function: head
 
 Returns the first element of a list
 */
-pure fn head<copy T>(ls: list<T>) : is_not_empty(ls) -> T {
+pure fn head<T: copy>(ls: list<T>) : is_not_empty(ls) -> T {
     alt ls {
         cons(hd, _) { ret hd; }
         nil. { fail "list empty" }
@@ -152,7 +152,7 @@ Function: append
 
 Appends one list to another
 */
-pure fn append<copy T>(l: list<T>, m: list<T>) -> list<T> {
+pure fn append<T: copy>(l: list<T>, m: list<T>) -> list<T> {
     alt l {
       nil. { ret m; }
       cons(x, xs) { let rest = append(*xs, m); ret cons(x, @rest); }
diff --git a/src/libstd/map.rs b/src/libstd/map.rs
index 3b6a45b9060..db47160216c 100644
--- a/src/libstd/map.rs
+++ b/src/libstd/map.rs
@@ -108,32 +108,32 @@ type hashmap<K, V> = obj {
 /* Section: Operations */
 
 mod chained {
-    type entry<copy K, copy V> = {
+    type entry<K: copy, V: copy> = {
         hash: uint,
         key: K,
         mutable value: V,
         mutable next: chain<K, V>
     };
 
-    tag chain<copy K, copy V> {
+    tag chain<K: copy, V: copy> {
         present(@entry<K, V>);
         absent;
     }
 
-    type t<copy K, copy V> = {
+    type t<K: copy, V: copy> = {
         mutable size: uint,
         mutable chains: [mutable chain<K,V>],
         hasher: hashfn<K>,
         eqer: eqfn<K>
     };
 
-    tag search_result<copy K, copy V> {
+    tag search_result<K: copy, V: copy> {
         not_found;
         found_first(uint, @entry<K,V>);
         found_after(@entry<K,V>, @entry<K,V>);
     }
 
-    fn search_rem<copy K, copy V>(tbl: t<K,V>,
+    fn search_rem<K: copy, V: copy>(tbl: t<K,V>,
                                   k: K,
                                   h: uint,
                                   idx: uint,
@@ -163,7 +163,7 @@ mod chained {
         util::unreachable();
     }
 
-    fn search_tbl<copy K, copy V>(
+    fn search_tbl<K: copy, V: copy>(
         tbl: t<K,V>, k: K, h: uint) -> search_result<K,V> {
         let idx = h % vec::len(tbl.chains);
         alt tbl.chains[idx] {
@@ -185,7 +185,7 @@ mod chained {
         }
     }
 
-    fn insert<copy K, copy V>(tbl: t<K,V>, k: K, v: V) -> bool {
+    fn insert<K: copy, V: copy>(tbl: t<K,V>, k: K, v: V) -> bool {
         let hash = tbl.hasher(k);
         alt search_tbl(tbl, k, hash) {
           not_found. {
@@ -210,7 +210,7 @@ mod chained {
         }
     }
 
-    fn get<copy K, copy V>(tbl: t<K,V>, k: K) -> core::option::t<V> {
+    fn get<K: copy, V: copy>(tbl: t<K,V>, k: K) -> core::option::t<V> {
         alt search_tbl(tbl, k, tbl.hasher(k)) {
           not_found. {
             ret core::option::none;
@@ -226,7 +226,7 @@ mod chained {
         }
     }
 
-    fn remove<copy K, copy V>(tbl: t<K,V>, k: K) -> core::option::t<V> {
+    fn remove<K: copy, V: copy>(tbl: t<K,V>, k: K) -> core::option::t<V> {
         alt search_tbl(tbl, k, tbl.hasher(k)) {
           not_found. {
             ret core::option::none;
@@ -246,11 +246,11 @@ mod chained {
         }
     }
 
-    fn chains<copy K, copy V>(nchains: uint) -> [mutable chain<K,V>] {
+    fn chains<K: copy, V: copy>(nchains: uint) -> [mutable chain<K,V>] {
         ret vec::init_elt_mut(absent, nchains);
     }
 
-    fn foreach_entry<copy K, copy V>(chain0: chain<K,V>,
+    fn foreach_entry<K: copy, V: copy>(chain0: chain<K,V>,
                                      blk: block(@entry<K,V>)) {
         let chain = chain0;
         while true {
@@ -265,7 +265,7 @@ mod chained {
         }
     }
 
-    fn foreach_chain<copy K, copy V>(chains: [const chain<K,V>],
+    fn foreach_chain<K: copy, V: copy>(chains: [const chain<K,V>],
                                      blk: block(@entry<K,V>)) {
         let i = 0u, n = vec::len(chains);
         while i < n {
@@ -274,7 +274,7 @@ mod chained {
         }
     }
 
-    fn rehash<copy K, copy V>(tbl: t<K,V>) {
+    fn rehash<K: copy, V: copy>(tbl: t<K,V>) {
         let old_chains = tbl.chains;
         let n_old_chains = vec::len(old_chains);
         let n_new_chains: uint = uint::next_power_of_two(n_old_chains + 1u);
@@ -286,7 +286,7 @@ mod chained {
         }
     }
 
-    fn items<copy K, copy V>(tbl: t<K,V>, blk: block(K,V)) {
+    fn items<K: copy, V: copy>(tbl: t<K,V>, blk: block(K,V)) {
         let tbl_chains = tbl.chains;  // Satisfy alias checker.
         foreach_chain(tbl_chains) { |entry|
             let key = entry.key;
@@ -295,7 +295,7 @@ mod chained {
         }
     }
 
-    obj o<copy K, copy V>(tbl: @t<K,V>,
+    obj o<K: copy, V: copy>(tbl: @t<K,V>,
                           lf: util::rational) {
         fn size() -> uint {
             ret tbl.size;
@@ -343,7 +343,8 @@ mod chained {
         }
     }
 
-    fn mk<copy K, copy V>(hasher: hashfn<K>, eqer: eqfn<K>) -> hashmap<K,V> {
+    fn mk<K: copy, V: copy>(hasher: hashfn<K>, eqer: eqfn<K>)
+        -> hashmap<K,V> {
         let initial_capacity: uint = 32u; // 2^5
         let t = @{mutable size: 0u,
                   mutable chains: chains(initial_capacity),
@@ -363,7 +364,7 @@ Parameters:
 hasher - The hash function for key type K
 eqer - The equality function for key type K
 */
-fn mk_hashmap<copy K, copy V>(hasher: hashfn<K>, eqer: eqfn<K>)
+fn mk_hashmap<K: copy, V: copy>(hasher: hashfn<K>, eqer: eqfn<K>)
     -> hashmap<K, V> {
     ret chained::mk(hasher, eqer);
 }
@@ -373,7 +374,7 @@ Function: new_str_hash
 
 Construct a hashmap for string keys
 */
-fn new_str_hash<copy V>() -> hashmap<str, V> {
+fn new_str_hash<V: copy>() -> hashmap<str, V> {
     ret mk_hashmap(str::hash, str::eq);
 }
 
@@ -382,7 +383,7 @@ Function: new_int_hash
 
 Construct a hashmap for int keys
 */
-fn new_int_hash<copy V>() -> hashmap<int, V> {
+fn new_int_hash<V: copy>() -> hashmap<int, V> {
     fn hash_int(&&x: int) -> uint { ret x as uint; }
     fn eq_int(&&a: int, &&b: int) -> bool { ret a == b; }
     ret mk_hashmap(hash_int, eq_int);
@@ -393,7 +394,7 @@ Function: new_uint_hash
 
 Construct a hashmap for uint keys
 */
-fn new_uint_hash<copy V>() -> hashmap<uint, V> {
+fn new_uint_hash<V: copy>() -> hashmap<uint, V> {
     fn hash_uint(&&x: uint) -> uint { ret x; }
     fn eq_uint(&&a: uint, &&b: uint) -> bool { ret a == b; }
     ret mk_hashmap(hash_uint, eq_uint);
diff --git a/src/libstd/smallintmap.rs b/src/libstd/smallintmap.rs
index 5ba1366ccb5..d40adc84739 100644
--- a/src/libstd/smallintmap.rs
+++ b/src/libstd/smallintmap.rs
@@ -30,7 +30,7 @@ Function: insert
 Add a value to the map. If the map already contains a value for
 the specified key then the original value is replaced.
 */
-fn insert<copy T>(m: smallintmap<T>, key: uint, val: T) {
+fn insert<T: copy>(m: smallintmap<T>, key: uint, val: T) {
     vec::grow_set::<option::t<T>>(m.v, key, none::<T>, some::<T>(val));
 }
 
@@ -40,7 +40,7 @@ Function: find
 Get the value for the specified key. If the key does not exist
 in the map then returns none.
 */
-fn find<copy T>(m: smallintmap<T>, key: uint) -> option::t<T> {
+fn find<T: copy>(m: smallintmap<T>, key: uint) -> option::t<T> {
     if key < vec::len::<option::t<T>>(m.v) { ret m.v[key]; }
     ret none::<T>;
 }
@@ -54,7 +54,7 @@ Failure:
 
 If the key does not exist in the map
 */
-fn get<copy T>(m: smallintmap<T>, key: uint) -> T {
+fn get<T: copy>(m: smallintmap<T>, key: uint) -> T {
     alt find(m, key) {
       none. { #error("smallintmap::get(): key not present"); fail; }
       some(v) { ret v; }
@@ -66,13 +66,13 @@ Method: contains_key
 
 Returns true if the map contains a value for the specified key
 */
-fn contains_key<copy T>(m: smallintmap<T>, key: uint) -> bool {
+fn contains_key<T: copy>(m: smallintmap<T>, key: uint) -> bool {
     ret !option::is_none(find::<T>(m, key));
 }
 
 // FIXME: Are these really useful?
 
-fn truncate<copy T>(m: smallintmap<T>, len: uint) {
+fn truncate<T: copy>(m: smallintmap<T>, len: uint) {
     m.v = vec::slice_mut::<option::t<T>>(m.v, 0u, len);
 }
 
diff --git a/src/libstd/sort.rs b/src/libstd/sort.rs
index 38ab4f3cfb1..190497b48dd 100644
--- a/src/libstd/sort.rs
+++ b/src/libstd/sort.rs
@@ -20,8 +20,8 @@ Merge sort. Returns a new vector containing the sorted list.
 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<copy T>(le: lteq<T>, v: [const T]) -> [T] {
-    fn merge<copy T>(le: lteq<T>, a: [T], b: [T]) -> [T] {
+fn merge_sort<T: copy>(le: lteq<T>, v: [const T]) -> [T] {
+    fn merge<T: copy>(le: lteq<T>, a: [T], b: [T]) -> [T] {
         let rs: [T] = [];
         let a_len: uint = len::<T>(a);
         let a_ix: uint = 0u;
@@ -46,7 +46,7 @@ fn merge_sort<copy T>(le: lteq<T>, v: [const T]) -> [T] {
     ret merge::<T>(le, merge_sort::<T>(le, a), merge_sort::<T>(le, b));
 }
 
-fn part<copy T>(compare_func: lteq<T>, arr: [mutable T], left: uint,
+fn part<T: copy>(compare_func: lteq<T>, arr: [mutable T], left: uint,
                 right: uint, pivot: uint) -> uint {
     let pivot_value = arr[pivot];
     arr[pivot] <-> arr[right];
@@ -63,7 +63,7 @@ fn part<copy T>(compare_func: lteq<T>, arr: [mutable T], left: uint,
     ret storage_index;
 }
 
-fn qsort<copy T>(compare_func: lteq<T>, arr: [mutable T], left: uint,
+fn qsort<T: copy>(compare_func: lteq<T>, arr: [mutable T], left: uint,
              right: uint) {
     if right > left {
         let pivot = (left + right) / 2u;
@@ -84,12 +84,12 @@ Quicksort. Sorts a mutable vector in place.
 Has worst case O(n^2) performance, average case O(n log n).
 This is an unstable sort.
 */
-fn quick_sort<copy T>(compare_func: lteq<T>, arr: [mutable T]) {
+fn quick_sort<T: copy>(compare_func: lteq<T>, arr: [mutable T]) {
     if len::<T>(arr) == 0u { ret; }
     qsort::<T>(compare_func, arr, 0u, len::<T>(arr) - 1u);
 }
 
-fn qsort3<copy T>(compare_func_lt: lteq<T>, compare_func_eq: lteq<T>,
+fn qsort3<T: copy>(compare_func_lt: lteq<T>, compare_func_eq: lteq<T>,
                   arr: [mutable T], left: int, right: int) {
     if right <= left { ret; }
     let v: T = arr[right];
@@ -150,7 +150,7 @@ According to these slides this is the algorithm of choice for
 
 This is an unstable sort.
 */
-fn quick_sort3<copy T>(compare_func_lt: lteq<T>, compare_func_eq: lteq<T>,
+fn quick_sort3<T: copy>(compare_func_lt: lteq<T>, compare_func_eq: lteq<T>,
                        arr: [mutable T]) {
     if len::<T>(arr) == 0u { ret; }
     qsort3::<T>(compare_func_lt, compare_func_eq, arr, 0,
diff --git a/src/libstd/test.rs b/src/libstd/test.rs
index 4c0a52116cc..43a869f0319 100644
--- a/src/libstd/test.rs
+++ b/src/libstd/test.rs
@@ -115,7 +115,7 @@ fn run_tests_console(opts: test_opts,
     run_tests_console_(opts, tests, default_test_to_task)
 }
 
-fn run_tests_console_<copy T>(opts: test_opts, tests: [test_desc<T>],
+fn run_tests_console_<T: copy>(opts: test_opts, tests: [test_desc<T>],
                               to_task: test_to_task<T>) -> bool {
 
     type test_state =
@@ -127,7 +127,7 @@ fn run_tests_console_<copy T>(opts: test_opts, tests: [test_desc<T>],
           mutable ignored: uint,
           mutable failures: [test_desc<T>]};
 
-    fn callback<copy T>(event: testevent<T>, st: test_state) {
+    fn callback<T: copy>(event: testevent<T>, st: test_state) {
         alt event {
           te_filtered(filtered_tests) {
             st.total = vec::len(filtered_tests);
@@ -220,7 +220,7 @@ tag testevent<T> {
     te_result(test_desc<T>, test_result);
 }
 
-fn run_tests<copy T>(opts: test_opts, tests: [test_desc<T>],
+fn run_tests<T: copy>(opts: test_opts, tests: [test_desc<T>],
                      to_task: test_to_task<T>,
                      callback: fn@(testevent<T>)) {
 
@@ -254,7 +254,7 @@ fn run_tests<copy T>(opts: test_opts, tests: [test_desc<T>],
 
 fn get_concurrency() -> uint { rustrt::sched_threads() }
 
-fn filter_tests<copy T>(opts: test_opts,
+fn filter_tests<T: copy>(opts: test_opts,
                         tests: [test_desc<T>]) -> [test_desc<T>] {
     let filtered = tests;
 
@@ -268,7 +268,7 @@ fn filter_tests<copy T>(opts: test_opts,
           option::none. { "" }
         };
 
-        fn filter_fn<copy T>(test: test_desc<T>, filter_str: str) ->
+        fn filter_fn<T: copy>(test: test_desc<T>, filter_str: str) ->
             option::t<test_desc<T>> {
             if str::find(test.name, filter_str) >= 0 {
                 ret option::some(test);
@@ -284,7 +284,7 @@ fn filter_tests<copy T>(opts: test_opts,
     filtered = if !opts.run_ignored {
         filtered
     } else {
-        fn filter<copy T>(test: test_desc<T>) -> option::t<test_desc<T>> {
+        fn filter<T: copy>(test: test_desc<T>) -> option::t<test_desc<T>> {
             if test.ignore {
                 ret option::some({name: test.name,
                                   fn: test.fn,
@@ -310,7 +310,7 @@ fn filter_tests<copy T>(opts: test_opts,
 
 type test_future<T> = {test: test_desc<T>, wait: fn@() -> test_result};
 
-fn run_test<copy T>(test: test_desc<T>,
+fn run_test<T: copy>(test: test_desc<T>,
                     to_task: test_to_task<T>) -> test_future<T> {
     if test.ignore {
         ret {test: test, wait: fn () -> test_result { tr_ignored }};
diff --git a/src/libstd/treemap.rs b/src/libstd/treemap.rs
index 74d40f1c05d..646fde401db 100644
--- a/src/libstd/treemap.rs
+++ b/src/libstd/treemap.rs
@@ -44,7 +44,7 @@ Function: insert
 
 Insert a value into the map
 */
-fn insert<copy K, copy V>(m: treemap<K, V>, k: K, v: V) {
+fn insert<K: copy, V: copy>(m: treemap<K, V>, k: K, v: V) {
     alt m {
       @empty. { *m = node(@k, @v, @mutable empty, @mutable empty); }
       @node(@kk, _, _, _) {
@@ -63,7 +63,7 @@ Function: find
 
 Find a value based on the key
 */
-fn find<copy K, copy V>(m: treemap<K, V>, k: K) -> option<V> {
+fn find<K: copy, V: copy>(m: treemap<K, V>, k: K) -> option<V> {
     alt *m {
       empty. { none }
       node(@kk, @v, _, _) {
diff --git a/src/libstd/util.rs b/src/libstd/util.rs
index f4d984a8937..f7bfc18a257 100644
--- a/src/libstd/util.rs
+++ b/src/libstd/util.rs
@@ -7,7 +7,7 @@ Function: id
 
 The identity function
 */
-pure fn id<copy T>(x: T) -> T { x }
+pure fn id<T: copy>(x: T) -> T { x }
 
 /*
 Function: unreachable