about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2013-01-31 17:12:29 -0800
committerNiko Matsakis <niko@alum.mit.edu>2013-02-07 05:53:30 -0800
commita32498d8464e0dfa4e2cb31967a66e076da40109 (patch)
tree62fc02049c4d06ccd64a704f6f9e3af53d2835e3 /src/libstd
parent82d73963334f01b818cda767b44cd0c8f3baf4cc (diff)
downloadrust-a32498d8464e0dfa4e2cb31967a66e076da40109.tar.gz
rust-a32498d8464e0dfa4e2cb31967a66e076da40109.zip
Make ~fn non-copyable, make &fn copyable, split barefn/closure types,
correct handling of moves for struct-record update.

Part of #3678.  Fixes #2828, #3904, #4719.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/arc.rs2
-rw-r--r--src/libstd/arena.rs2
-rw-r--r--src/libstd/base64.rs2
-rw-r--r--src/libstd/bitv.rs2
-rw-r--r--src/libstd/c_vec.rs1
-rw-r--r--src/libstd/cell.rs2
-rw-r--r--src/libstd/cmp.rs1
-rw-r--r--src/libstd/comm.rs3
-rw-r--r--src/libstd/dbg.rs1
-rw-r--r--src/libstd/deque.rs1
-rw-r--r--src/libstd/ebml.rs2
-rw-r--r--src/libstd/fun_treemap.rs2
-rw-r--r--src/libstd/getopts.rs1
-rw-r--r--src/libstd/json.rs1
-rw-r--r--src/libstd/list.rs1
-rw-r--r--src/libstd/md4.rs2
-rw-r--r--src/libstd/net_ip.rs1
-rw-r--r--src/libstd/net_tcp.rs1
-rw-r--r--src/libstd/net_url.rs3
-rw-r--r--src/libstd/oldmap.rs1
-rw-r--r--src/libstd/par.rs51
-rw-r--r--src/libstd/prettyprint.rs2
-rw-r--r--src/libstd/rl.rs4
-rw-r--r--src/libstd/rope.rs2
-rw-r--r--src/libstd/serialize.rs1
-rw-r--r--src/libstd/sha1.rs2
-rw-r--r--src/libstd/smallintmap.rs1
-rw-r--r--src/libstd/sort.rs14
-rw-r--r--src/libstd/std.rc4
-rw-r--r--src/libstd/sync.rs2
-rw-r--r--src/libstd/tempfile.rs2
-rw-r--r--src/libstd/term.rs1
-rw-r--r--src/libstd/test.rs209
-rw-r--r--src/libstd/time.rs2
-rw-r--r--src/libstd/timer.rs2
-rw-r--r--src/libstd/treemap.rs2
-rw-r--r--src/libstd/uv_global_loop.rs2
-rw-r--r--src/libstd/uv_iotask.rs1
-rw-r--r--src/libstd/workcache.rs2
39 files changed, 146 insertions, 192 deletions
diff --git a/src/libstd/arc.rs b/src/libstd/arc.rs
index a8d3f156104..a1fd7a66f7e 100644
--- a/src/libstd/arc.rs
+++ b/src/libstd/arc.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// NB: transitionary, de-mode-ing.
-#[forbid(deprecated_mode)];
 /**
  * Concurrency-enabled mechanisms for sharing mutable and/or immutable state
  * between tasks.
diff --git a/src/libstd/arena.rs b/src/libstd/arena.rs
index 3e21a320d44..a2cbe27ea90 100644
--- a/src/libstd/arena.rs
+++ b/src/libstd/arena.rs
@@ -32,8 +32,6 @@
 // overhead when initializing plain-old-data and means we don't need
 // to waste time running the destructors of POD.
 
-#[forbid(deprecated_mode)];
-
 use arena;
 use list;
 use list::{List, Cons, Nil};
diff --git a/src/libstd/base64.rs b/src/libstd/base64.rs
index 5813e0919d9..d9e121798f1 100644
--- a/src/libstd/base64.rs
+++ b/src/libstd/base64.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[forbid(deprecated_mode)];
-
 use core::io::Reader;
 use core::iter;
 use core::str;
diff --git a/src/libstd/bitv.rs b/src/libstd/bitv.rs
index 244d388bffe..a94c4f79064 100644
--- a/src/libstd/bitv.rs
+++ b/src/libstd/bitv.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[forbid(deprecated_mode)];
-
 use core::ops;
 use core::prelude::*;
 use core::uint;
diff --git a/src/libstd/c_vec.rs b/src/libstd/c_vec.rs
index 17920f5de3f..5ea5418d988 100644
--- a/src/libstd/c_vec.rs
+++ b/src/libstd/c_vec.rs
@@ -35,7 +35,6 @@
  * great care must be taken to ensure that a reference to the c_vec::t is
  * still held if needed.
  */
-#[forbid(deprecated_mode)];
 
 use core::libc;
 use core::option;
diff --git a/src/libstd/cell.rs b/src/libstd/cell.rs
index aae84a86957..10a896a4089 100644
--- a/src/libstd/cell.rs
+++ b/src/libstd/cell.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[forbid(deprecated_mode)];
-
 use core::option;
 use core::prelude::*;
 
diff --git a/src/libstd/cmp.rs b/src/libstd/cmp.rs
index 0bd7538d947..110559ddcef 100644
--- a/src/libstd/cmp.rs
+++ b/src/libstd/cmp.rs
@@ -8,7 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[forbid(deprecated_mode)];
 //! Additional general-purpose comparison functionality.
 
 use core::f32;
diff --git a/src/libstd/comm.rs b/src/libstd/comm.rs
index dc0fbbac641..71eb29e26eb 100644
--- a/src/libstd/comm.rs
+++ b/src/libstd/comm.rs
@@ -14,9 +14,6 @@ Higher level communication abstractions.
 
 */
 
-// NB: transitionary, de-mode-ing.
-#[forbid(deprecated_mode)];
-
 use core::pipes::{GenericChan, GenericSmartChan, GenericPort};
 use core::pipes::{Chan, Port, Selectable, Peekable};
 use core::pipes;
diff --git a/src/libstd/dbg.rs b/src/libstd/dbg.rs
index cf1b816f238..7813357caf2 100644
--- a/src/libstd/dbg.rs
+++ b/src/libstd/dbg.rs
@@ -8,7 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[forbid(deprecated_mode)];
 //! Unsafe debugging functions for inspecting values.
 
 use core::cast::reinterpret_cast;
diff --git a/src/libstd/deque.rs b/src/libstd/deque.rs
index 2f001ae866c..465c5d8f8fe 100644
--- a/src/libstd/deque.rs
+++ b/src/libstd/deque.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 //! A deque. Untested as of yet. Likely buggy
-#[forbid(deprecated_mode)];
 #[forbid(non_camel_case_types)];
 
 use core::cmp::Eq;
diff --git a/src/libstd/ebml.rs b/src/libstd/ebml.rs
index aaeecfb3302..768d2dbf2d4 100644
--- a/src/libstd/ebml.rs
+++ b/src/libstd/ebml.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[forbid(deprecated_mode)];
-
 use serialize;
 
 use core::io;
diff --git a/src/libstd/fun_treemap.rs b/src/libstd/fun_treemap.rs
index e0d4b95a7e4..d6c2cf5a265 100644
--- a/src/libstd/fun_treemap.rs
+++ b/src/libstd/fun_treemap.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[forbid(deprecated_mode)];
-
 /*!
  * A functional key,value store that works on anything.
  *
diff --git a/src/libstd/getopts.rs b/src/libstd/getopts.rs
index 6e1a0861035..fa8fdf56428 100644
--- a/src/libstd/getopts.rs
+++ b/src/libstd/getopts.rs
@@ -72,7 +72,6 @@
  *         do_work(input, output);
  *     }
  */
-#[forbid(deprecated_mode)];
 
 use core::cmp::Eq;
 use core::prelude::*;
diff --git a/src/libstd/json.rs b/src/libstd/json.rs
index 13b58c43300..99c6c2f008d 100644
--- a/src/libstd/json.rs
+++ b/src/libstd/json.rs
@@ -10,7 +10,6 @@
 
 // Rust JSON serialization library
 // Copyright (c) 2011 Google Inc.
-#[forbid(deprecated_mode)];
 #[forbid(non_camel_case_types)];
 
 //! json serialization
diff --git a/src/libstd/list.rs b/src/libstd/list.rs
index 3016abee464..140c2013738 100644
--- a/src/libstd/list.rs
+++ b/src/libstd/list.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 //! A standard linked list
-#[forbid(deprecated_mode)];
 
 use core::cmp::Eq;
 use core::option;
diff --git a/src/libstd/md4.rs b/src/libstd/md4.rs
index 718e805b5d9..1d831af0e29 100644
--- a/src/libstd/md4.rs
+++ b/src/libstd/md4.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[forbid(deprecated_mode)];
-
 use core::str;
 use core::uint;
 use core::vec;
diff --git a/src/libstd/net_ip.rs b/src/libstd/net_ip.rs
index f4fd69aae1e..511e80b0160 100644
--- a/src/libstd/net_ip.rs
+++ b/src/libstd/net_ip.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 //! Types/fns concerning Internet Protocol (IP), versions 4 & 6
-#[forbid(deprecated_mode)];
 
 use core::libc;
 use core::prelude::*;
diff --git a/src/libstd/net_tcp.rs b/src/libstd/net_tcp.rs
index 429bd6ae474..c90518f1692 100644
--- a/src/libstd/net_tcp.rs
+++ b/src/libstd/net_tcp.rs
@@ -10,6 +10,7 @@
 
 //! High-level interface to libuv's TCP functionality
 // FIXME #4425: Need FFI fixes
+
 #[allow(deprecated_mode)];
 
 use future;
diff --git a/src/libstd/net_url.rs b/src/libstd/net_url.rs
index b32c97c6998..9403438dde0 100644
--- a/src/libstd/net_url.rs
+++ b/src/libstd/net_url.rs
@@ -9,7 +9,8 @@
 // except according to those terms.
 
 //! Types/fns concerning URLs (see RFC 3986)
-#[forbid(deprecated_mode)];
+
+#[allow(deprecated_mode)];
 
 use core::cmp::Eq;
 use core::dvec::DVec;
diff --git a/src/libstd/oldmap.rs b/src/libstd/oldmap.rs
index 18cfc8d4a2d..ad7e8e50e38 100644
--- a/src/libstd/oldmap.rs
+++ b/src/libstd/oldmap.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 //! A map type - **deprecated**, use `core::hashmap` instead
-#[forbid(deprecated_mode)];
 
 use core::container::{Container, Mutable, Map};
 use core::cmp::Eq;
diff --git a/src/libstd/par.rs b/src/libstd/par.rs
index 779dda0ab29..8293ff1c2af 100644
--- a/src/libstd/par.rs
+++ b/src/libstd/par.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[forbid(deprecated_mode)];
-
 use core::cast;
 use core::prelude::*;
 use core::ptr;
@@ -38,7 +36,7 @@ const min_granularity : uint = 1024u;
  */
 fn map_slices<A: Copy Owned, B: Copy Owned>(
     xs: &[A],
-    f: fn() -> fn~(uint, v: &[A]) -> B)
+    f: &fn() -> ~fn(uint, v: &[A]) -> B)
     -> ~[B] {
 
     let len = xs.len();
@@ -93,9 +91,9 @@ fn map_slices<A: Copy Owned, B: Copy Owned>(
 
 /// A parallel version of map.
 pub fn map<A: Copy Owned, B: Copy Owned>(
-    xs: &[A], f: fn~(&A) -> B) -> ~[B] {
+    xs: &[A], fn_factory: &fn() -> ~fn(&A) -> B) -> ~[B] {
     vec::concat(map_slices(xs, || {
-        let f = copy f;
+        let f = fn_factory();
         fn~(_base: uint, slice : &[A]) -> ~[B] {
             vec::map(slice, |x| f(x))
         }
@@ -103,10 +101,12 @@ pub fn map<A: Copy Owned, B: Copy Owned>(
 }
 
 /// A parallel version of mapi.
-pub fn mapi<A: Copy Owned, B: Copy Owned>(xs: &[A],
-                                    f: fn~(uint, &A) -> B) -> ~[B] {
+pub fn mapi<A: Copy Owned, B: Copy Owned>(
+    xs: &[A],
+    fn_factory: &fn() -> ~fn(uint, &A) -> B) -> ~[B]
+{
     let slices = map_slices(xs, || {
-        let f = copy f;
+        let f = fn_factory();
         fn~(base: uint, slice : &[A], copy f) -> ~[B] {
             vec::mapi(slice, |i, x| {
                 f(i + base, x)
@@ -119,32 +119,13 @@ pub fn mapi<A: Copy Owned, B: Copy Owned>(xs: &[A],
     r
 }
 
-/**
- * A parallel version of mapi.
- *
- * 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 Owned, B: Copy Owned>(
-    xs: &[A], f: fn() -> fn~(uint, A) -> B) -> ~[B] {
-    let slices = map_slices(xs, || {
-        let f = f();
-        fn~(base: uint, slice : &[A], move f) -> ~[B] {
-            vec::mapi(slice, |i, x| {
-                f(i + base, *x)
-            })
-        }
-    });
-    let r = vec::concat(slices);
-    log(info, (r.len(), xs.len()));
-    assert(r.len() == xs.len());
-    r
-}
-
 /// Returns true if the function holds for all elements in the vector.
-pub fn alli<A: Copy Owned>(xs: &[A], f: fn~(uint, &A) -> bool) -> bool {
+pub fn alli<A: Copy Owned>(
+    xs: &[A],
+    fn_factory: &fn() -> ~fn(uint, &A) -> bool) -> bool
+{
     do vec::all(map_slices(xs, || {
-        let f = copy f;
+        let f = fn_factory();
         fn~(base: uint, slice : &[A], copy f) -> bool {
             vec::alli(slice, |i, x| {
                 f(i + base, x)
@@ -154,9 +135,11 @@ pub fn alli<A: Copy Owned>(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 Owned>(xs: &[A], f: fn~(&A) -> bool) -> bool {
+pub fn any<A: Copy Owned>(
+    xs: &[A],
+    fn_factory: &fn() -> ~fn(&A) -> bool) -> bool {
     do vec::any(map_slices(xs, || {
-        let f = copy f;
+        let f = fn_factory();
         fn~(_base : uint, slice: &[A], copy f) -> bool {
             vec::any(slice, |x| f(x))
         }
diff --git a/src/libstd/prettyprint.rs b/src/libstd/prettyprint.rs
index d07c29d624c..dc2e3d3da2b 100644
--- a/src/libstd/prettyprint.rs
+++ b/src/libstd/prettyprint.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[forbid(deprecated_mode)];
-
 use serialize;
 
 use core::io::Writer;
diff --git a/src/libstd/rl.rs b/src/libstd/rl.rs
index 5dd2a056327..30baa3cc5f1 100644
--- a/src/libstd/rl.rs
+++ b/src/libstd/rl.rs
@@ -64,7 +64,7 @@ pub unsafe fn read(prompt: ~str) -> Option<~str> {
     }
 }
 
-pub type CompletionCb = fn~(~str, fn(~str));
+pub type CompletionCb = @fn(~str, fn(~str));
 
 fn complete_key(_v: @CompletionCb) {}
 
@@ -75,7 +75,7 @@ pub unsafe fn complete(cb: CompletionCb) {
 
         extern fn callback(line: *c_char, completions: *()) {
             unsafe {
-                let cb = copy *task::local_data::local_data_get(complete_key)
+                let cb = *task::local_data::local_data_get(complete_key)
                     .get();
 
                 do cb(str::raw::from_c_str(line)) |suggestion| {
diff --git a/src/libstd/rope.rs b/src/libstd/rope.rs
index c7601f6b6b5..f8aef2c5f1e 100644
--- a/src/libstd/rope.rs
+++ b/src/libstd/rope.rs
@@ -33,8 +33,6 @@
  * * access to a character by index is logarithmic (linear in strings);
  */
 
-#[forbid(deprecated_mode)];
-
 use core::cast;
 use core::char;
 use core::option;
diff --git a/src/libstd/serialize.rs b/src/libstd/serialize.rs
index 4938ead9ea8..972df73d216 100644
--- a/src/libstd/serialize.rs
+++ b/src/libstd/serialize.rs
@@ -14,7 +14,6 @@
 Core encoding and decoding interfaces.
 */
 
-#[forbid(deprecated_mode)];
 #[forbid(non_camel_case_types)];
 
 use core::at_vec;
diff --git a/src/libstd/sha1.rs b/src/libstd/sha1.rs
index 5fb7d892c58..6209170ac3d 100644
--- a/src/libstd/sha1.rs
+++ b/src/libstd/sha1.rs
@@ -22,8 +22,6 @@
  * the `reset` method.
  */
 
-#[forbid(deprecated_mode)];
-
 use core::str;
 use core::uint;
 use core::vec;
diff --git a/src/libstd/smallintmap.rs b/src/libstd/smallintmap.rs
index 1cd35722ab4..9af596eb1f5 100644
--- a/src/libstd/smallintmap.rs
+++ b/src/libstd/smallintmap.rs
@@ -12,7 +12,6 @@
  * A simple map based on a vector for small integer keys. Space requirements
  * are O(highest integer key).
  */
-#[forbid(deprecated_mode)];
 
 use core::container::{Container, Mutable, Map, Set};
 use core::option::{Some, None};
diff --git a/src/libstd/sort.rs b/src/libstd/sort.rs
index 6e89cd9e24f..680a2b99c4a 100644
--- a/src/libstd/sort.rs
+++ b/src/libstd/sort.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 //! Sorting methods
-#[forbid(deprecated_mode)];
 
 use core::cmp::{Eq, Ord};
 use core::dvec::DVec;
@@ -64,14 +63,13 @@ pub pure fn merge_sort<T: Copy>(v: &[const T], le: Le<T>) -> ~[T] {
     }
 }
 
-fn part<T: Copy>(arr: &mut [T], left: uint,
-                right: uint, pivot: uint, compare_func: Le<T>) -> uint {
-    let pivot_value = arr[pivot];
+fn part<T>(arr: &mut [T], left: uint,
+           right: uint, pivot: uint, compare_func: Le<T>) -> uint {
     arr[pivot] <-> arr[right];
     let mut storage_index: uint = left;
     let mut i: uint = left;
     while i < right {
-        if compare_func(&arr[i], &pivot_value) {
+        if compare_func(&arr[i], &arr[right]) {
             arr[i] <-> arr[storage_index];
             storage_index += 1;
         }
@@ -81,8 +79,8 @@ fn part<T: Copy>(arr: &mut [T], left: uint,
     return storage_index;
 }
 
-fn qsort<T: Copy>(arr: &mut [T], left: uint,
-             right: uint, compare_func: Le<T>) {
+fn qsort<T>(arr: &mut [T], left: uint,
+            right: uint, compare_func: Le<T>) {
     if right > left {
         let pivot = (left + right) / 2u;
         let new_pivot = part::<T>(arr, left, right, pivot, compare_func);
@@ -100,7 +98,7 @@ fn qsort<T: Copy>(arr: &mut [T], left: uint,
  * Has worst case O(n^2) performance, average case O(n log n).
  * This is an unstable sort.
  */
-pub fn quick_sort<T: Copy>(arr: &mut [T], compare_func: Le<T>) {
+pub fn quick_sort<T>(arr: &mut [T], compare_func: Le<T>) {
     if len::<T>(arr) == 0u { return; }
     qsort::<T>(arr, 0u, len::<T>(arr) - 1u, compare_func);
 }
diff --git a/src/libstd/std.rc b/src/libstd/std.rc
index a2fbc8b1db1..8c142908d10 100644
--- a/src/libstd/std.rc
+++ b/src/libstd/std.rc
@@ -28,10 +28,6 @@ not required in or otherwise suitable for the core library.
 
 #[allow(vecs_implicitly_copyable)];
 #[deny(non_camel_case_types)];
-// XXX this is set to allow because there are two methods in encoding
-// that can't be silenced otherwise. Most every module is set to forbid
-#[allow(deprecated_mode)];
-#[forbid(deprecated_pattern)];
 #[allow(deprecated_self)];
 
 #[no_core];
diff --git a/src/libstd/sync.rs b/src/libstd/sync.rs
index 31c596c5038..b7e75897bf1 100644
--- a/src/libstd/sync.rs
+++ b/src/libstd/sync.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// NB: transitionary, de-mode-ing.
-#[forbid(deprecated_mode)];
 /**
  * The concurrency primitives you know and love.
  *
diff --git a/src/libstd/tempfile.rs b/src/libstd/tempfile.rs
index f10d54f3271..b786d913639 100644
--- a/src/libstd/tempfile.rs
+++ b/src/libstd/tempfile.rs
@@ -10,8 +10,6 @@
 
 //! Temporary files and directories
 
-#[forbid(deprecated_mode)];
-
 use core::os;
 use core::prelude::*;
 use core::rand;
diff --git a/src/libstd/term.rs b/src/libstd/term.rs
index ae5949e6f18..5616c7211c1 100644
--- a/src/libstd/term.rs
+++ b/src/libstd/term.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 //! Simple ANSI color library
-#[forbid(deprecated_mode)];
 
 use core::i32;
 use core::io;
diff --git a/src/libstd/test.rs b/src/libstd/test.rs
index 4f0b7da89aa..e83b759f901 100644
--- a/src/libstd/test.rs
+++ b/src/libstd/test.rs
@@ -15,8 +15,6 @@
 // simplest interface possible for representing and running tests
 // while providing a base that other test frameworks may build off of.
 
-#[forbid(deprecated_mode)];
-
 use getopts;
 use sort;
 use term;
@@ -51,20 +49,24 @@ pub type TestName = ~str;
 // the test succeeds; if the function fails then the test fails. We
 // may need to come up with a more clever definition of test in order
 // to support isolation of tests into tasks.
-pub type TestFn = fn~();
+pub type TestFn = ~fn();
 
 // The definition of a single test. A test runner will run a list of
 // these.
 pub struct TestDesc {
     name: TestName,
-    testfn: TestFn,
     ignore: bool,
     should_fail: bool
 }
 
+pub struct TestDescAndFn {
+    desc: TestDesc,
+    testfn: TestFn,
+}
+
 // The default console test runner. It accepts the command line
 // arguments and a vector of test_descs (generated at compile time).
-pub fn test_main(args: &[~str], tests: &[TestDesc]) {
+pub fn test_main(args: &[~str], tests: ~[TestDescAndFn]) {
     let opts =
         match parse_opts(args) {
           either::Left(move o) => o,
@@ -124,7 +126,7 @@ struct ConsoleTestState {
 
 // A simple console test runner
 pub fn run_tests_console(opts: &TestOpts,
-                     tests: &[TestDesc]) -> bool {
+                         tests: ~[TestDescAndFn]) -> bool {
 
     fn callback(event: &TestEvent, st: @ConsoleTestState) {
         debug!("callback(event=%?)", event);
@@ -247,17 +249,17 @@ fn print_failures(st: @ConsoleTestState) {
 
 #[test]
 fn should_sort_failures_before_printing_them() {
+    fn dummy() {}
+
     let s = do io::with_str_writer |wr| {
         let test_a = TestDesc {
             name: ~"a",
-            testfn: fn~() { },
             ignore: false,
             should_fail: false
         };
 
         let test_b = TestDesc {
             name: ~"b",
-            testfn: fn~() { },
             ignore: false,
             should_fail: false
         };
@@ -291,45 +293,44 @@ enum TestEvent {
 type MonitorMsg = (TestDesc, TestResult);
 
 fn run_tests(opts: &TestOpts,
-             tests: &[TestDesc],
+             tests: ~[TestDescAndFn],
              callback: fn@(e: TestEvent)) {
     let mut filtered_tests = filter_tests(opts, tests);
-    callback(TeFiltered(copy filtered_tests));
+
+    let filtered_descs = filtered_tests.map(|t| t.desc);
+    callback(TeFiltered(filtered_descs));
 
     // It's tempting to just spawn all the tests at once, but since we have
     // many tests that run in other processes we would be making a big mess.
     let concurrency = get_concurrency();
     debug!("using %u test tasks", concurrency);
 
-    let total = vec::len(filtered_tests);
-    let mut run_idx = 0;
-    let mut wait_idx = 0;
-    let mut done_idx = 0;
+    let mut remaining = filtered_tests;
+    vec::reverse(remaining);
+    let mut pending = 0;
 
     let (p, ch) = stream();
     let ch = SharedChan(ch);
 
-    while done_idx < total {
-        while wait_idx < concurrency && run_idx < total {
-            let test = copy filtered_tests[run_idx];
+    while pending > 0 || !remaining.is_empty() {
+        while pending < concurrency && !remaining.is_empty() {
+            let test = remaining.pop();
             if concurrency == 1 {
                 // We are doing one test at a time so we can print the name
                 // of the test before we run it. Useful for debugging tests
                 // that hang forever.
-                callback(TeWait(copy test));
+                callback(TeWait(test.desc));
             }
-            run_test(move test, ch.clone());
-            wait_idx += 1;
-            run_idx += 1;
+            run_test(test, ch.clone());
+            pending += 1;
         }
 
-        let (test, result) = p.recv();
+        let (desc, result) = p.recv();
         if concurrency != 1 {
-            callback(TeWait(copy test));
+            callback(TeWait(desc));
         }
-        callback(TeResult(move test, result));
-        wait_idx -= 1;
-        done_idx += 1;
+        callback(TeResult(desc, result));
+        pending -= 1;
     }
 }
 
@@ -349,10 +350,11 @@ fn get_concurrency() -> uint {
 }
 
 #[allow(non_implicitly_copyable_typarams)]
-pub fn filter_tests(opts: &TestOpts,
-                    tests: &[TestDesc])
-                 -> ~[TestDesc] {
-    let mut filtered = vec::slice(tests, 0, tests.len());
+pub fn filter_tests(
+    opts: &TestOpts,
+    tests: ~[TestDescAndFn]) -> ~[TestDescAndFn]
+{
+    let mut filtered = tests;
 
     // Remove tests that don't match the test filter
     filtered = if opts.filter.is_none() {
@@ -364,10 +366,10 @@ pub fn filter_tests(opts: &TestOpts,
           option::None => ~""
         };
 
-        fn filter_fn(test: &TestDesc, filter_str: &str) ->
-            Option<TestDesc> {
-            if str::contains(test.name, filter_str) {
-                return option::Some(copy *test);
+        fn filter_fn(test: TestDescAndFn, filter_str: &str) ->
+            Option<TestDescAndFn> {
+            if str::contains(test.desc.name, filter_str) {
+                return option::Some(test);
             } else { return option::None; }
         }
 
@@ -378,26 +380,26 @@ pub fn filter_tests(opts: &TestOpts,
     filtered = if !opts.run_ignored {
         move filtered
     } else {
-        fn filter(test: &TestDesc) -> Option<TestDesc> {
-            if test.ignore {
-                return option::Some(TestDesc {
-                    name: test.name,
-                    testfn: copy test.testfn,
-                    ignore: false,
-                    should_fail: test.should_fail});
-            } else { return option::None; }
+        fn filter(test: TestDescAndFn) -> Option<TestDescAndFn> {
+            if test.desc.ignore {
+                let TestDescAndFn {desc, testfn} = test;
+                Some(TestDescAndFn {
+                    desc: TestDesc {ignore: false, ..desc},
+                    testfn: testfn
+                })
+            } else {
+                None
+            }
         };
 
         vec::filter_map(filtered, |x| filter(x))
     };
 
     // Sort the tests alphabetically
-    filtered = {
-        pure fn lteq(t1: &TestDesc, t2: &TestDesc) -> bool {
-            str::le(t1.name, t2.name)
-        }
-        sort::merge_sort(filtered, lteq)
-    };
+    pure fn lteq(t1: &TestDescAndFn, t2: &TestDescAndFn) -> bool {
+        str::le(t1.desc.name, t2.desc.name)
+    }
+    sort::quick_sort(filtered, lteq);
 
     move filtered
 }
@@ -407,37 +409,40 @@ struct TestFuture {
     wait: fn@() -> TestResult,
 }
 
-pub fn run_test(test: TestDesc, monitor_ch: SharedChan<MonitorMsg>) {
-    if test.ignore {
-        monitor_ch.send((copy test, TrIgnored));
+pub fn run_test(test: TestDescAndFn, monitor_ch: SharedChan<MonitorMsg>) {
+    let TestDescAndFn {desc, testfn} = test;
+
+    if desc.ignore {
+        monitor_ch.send((desc, TrIgnored));
         return;
     }
 
-    do task::spawn |move test| {
-        let testfn = copy test.testfn;
+    let testfn_cell = ::cell::Cell(testfn);
+    do task::spawn {
         let mut result_future = None; // task::future_result(builder);
         task::task().unlinked().future_result(|+r| {
             result_future = Some(move r);
-        }).spawn(move testfn);
+        }).spawn(testfn_cell.take());
         let task_result = option::unwrap(move result_future).recv();
-        let test_result = calc_result(&test, task_result == task::Success);
-        monitor_ch.send((copy test, test_result));
+        let test_result = calc_result(&desc, task_result == task::Success);
+        monitor_ch.send((desc, test_result));
     };
 }
 
-fn calc_result(test: &TestDesc, task_succeeded: bool) -> TestResult {
+fn calc_result(desc: &TestDesc, task_succeeded: bool) -> TestResult {
     if task_succeeded {
-        if test.should_fail { TrFailed }
+        if desc.should_fail { TrFailed }
         else { TrOk }
     } else {
-        if test.should_fail { TrOk }
+        if desc.should_fail { TrOk }
         else { TrFailed }
     }
 }
 
 #[cfg(test)]
 mod tests {
-    use test::{TrFailed, TrIgnored, TrOk, filter_tests, parse_opts, TestDesc};
+    use test::{TrFailed, TrIgnored, TrOk, filter_tests, parse_opts,
+               TestDesc, TestDescAndFn};
     use test::{TestOpts, run_test};
 
     use core::either;
@@ -448,11 +453,13 @@ mod tests {
     #[test]
     pub fn do_not_run_ignored_tests() {
         fn f() { die!(); }
-        let desc = TestDesc {
-            name: ~"whatever",
+        let desc = TestDescAndFn {
+            desc: TestDesc {
+                name: ~"whatever",
+                ignore: true,
+                should_fail: false
+            },
             testfn: f,
-            ignore: true,
-            should_fail: false
         };
         let (p, ch) = stream();
         let ch = SharedChan(ch);
@@ -464,11 +471,13 @@ mod tests {
     #[test]
     pub fn ignored_tests_result_in_ignored() {
         fn f() { }
-        let desc = TestDesc {
-            name: ~"whatever",
+        let desc = TestDescAndFn {
+            desc: TestDesc {
+                name: ~"whatever",
+                ignore: true,
+                should_fail: false
+            },
             testfn: f,
-            ignore: true,
-            should_fail: false
         };
         let (p, ch) = stream();
         let ch = SharedChan(ch);
@@ -481,11 +490,13 @@ mod tests {
     #[ignore(cfg(windows))]
     pub fn test_should_fail() {
         fn f() { die!(); }
-        let desc = TestDesc {
-            name: ~"whatever",
+        let desc = TestDescAndFn {
+            desc: TestDesc {
+                name: ~"whatever",
+                ignore: false,
+                should_fail: true
+            },
             testfn: f,
-            ignore: false,
-            should_fail: true
         };
         let (p, ch) = stream();
         let ch = SharedChan(ch);
@@ -497,11 +508,13 @@ mod tests {
     #[test]
     pub fn test_should_fail_but_succeeds() {
         fn f() { }
-        let desc = TestDesc {
-            name: ~"whatever",
+        let desc = TestDescAndFn {
+            desc: TestDesc {
+                name: ~"whatever",
+                ignore: false,
+                should_fail: true
+            },
             testfn: f,
-            ignore: false,
-            should_fail: true
         };
         let (p, ch) = stream();
         let ch = SharedChan(ch);
@@ -532,6 +545,8 @@ mod tests {
 
     #[test]
     pub fn filter_for_ignored_option() {
+        fn dummy() {}
+
         // When we run ignored tests the test filter should filter out all the
         // unignored tests and flip the ignore flag on the rest to false
 
@@ -542,24 +557,28 @@ mod tests {
         };
 
         let tests = ~[
-            TestDesc {
-                name: ~"1",
-                testfn: fn~() { },
-                ignore: true,
-                should_fail: false,
+            TestDescAndFn {
+                desc: TestDesc {
+                    name: ~"1",
+                    ignore: true,
+                    should_fail: false,
+                },
+                testfn: dummy,
             },
-            TestDesc {
-                name: ~"2",
-                testfn: fn~() { },
-                ignore: false,
-                should_fail: false,
+            TestDescAndFn {
+                desc: TestDesc {
+                    name: ~"2",
+                    ignore: false,
+                    should_fail: false
+                },
+                testfn: dummy,
             },
         ];
         let filtered = filter_tests(&opts, tests);
 
         assert (vec::len(filtered) == 1);
-        assert (filtered[0].name == ~"1");
-        assert (filtered[0].ignore == false);
+        assert (filtered[0].desc.name == ~"1");
+        assert (filtered[0].desc.ignore == false);
     }
 
     #[test]
@@ -579,12 +598,16 @@ mod tests {
              ~"test::sort_tests"];
         let tests =
         {
-            let testfn = fn~() { };
+            fn testfn() { }
             let mut tests = ~[];
             for vec::each(names) |name| {
-                let test = TestDesc {
-                    name: *name, testfn: copy testfn, ignore: false,
-                    should_fail: false};
+                let test = TestDescAndFn {
+                    desc: TestDesc {
+                        name: *name, ignore: false,
+                        should_fail: false
+                    },
+                    testfn: testfn,
+                };
                 tests.push(move test);
             }
             move tests
@@ -604,7 +627,7 @@ mod tests {
 
         for vec::each(pairs) |p| {
             match *p {
-                (ref a, ref b) => { assert (*a == b.name); }
+                (ref a, ref b) => { assert (*a == b.desc.name); }
             }
         }
     }
diff --git a/src/libstd/time.rs b/src/libstd/time.rs
index dd25fc36d2d..f696d239d30 100644
--- a/src/libstd/time.rs
+++ b/src/libstd/time.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[forbid(deprecated_mode)];
-
 use core::cmp::{Eq, Ord};
 use core::int;
 use core::libc::{c_char, c_int, c_long, size_t, time_t};
diff --git a/src/libstd/timer.rs b/src/libstd/timer.rs
index f89830ed12a..1da1bc60314 100644
--- a/src/libstd/timer.rs
+++ b/src/libstd/timer.rs
@@ -10,8 +10,6 @@
 
 //! Utilities that leverage libuv's `uv_timer_*` API
 
-#[forbid(deprecated_mode)];
-
 use uv;
 use uv::iotask;
 use uv::iotask::IoTask;
diff --git a/src/libstd/treemap.rs b/src/libstd/treemap.rs
index 3cc287b16a3..1e90abcc03d 100644
--- a/src/libstd/treemap.rs
+++ b/src/libstd/treemap.rs
@@ -12,8 +12,6 @@
 //! trees. The only requirement for the types is that the key implements
 //! `Ord`, and that the `lt` method provides a total ordering.
 
-#[forbid(deprecated_mode)];
-
 use core::container::{Container, Mutable, Map, Set};
 use core::cmp::{Eq, Ord};
 use core::option::{Option, Some, None};
diff --git a/src/libstd/uv_global_loop.rs b/src/libstd/uv_global_loop.rs
index 736954f6b22..9763f655a6f 100644
--- a/src/libstd/uv_global_loop.rs
+++ b/src/libstd/uv_global_loop.rs
@@ -10,8 +10,6 @@
 
 //! A process-wide libuv event loop for library use.
 
-#[forbid(deprecated_mode)];
-
 use ll = uv_ll;
 use iotask = uv_iotask;
 use get_gl = get;
diff --git a/src/libstd/uv_iotask.rs b/src/libstd/uv_iotask.rs
index fe4137f76be..a44fef54b72 100644
--- a/src/libstd/uv_iotask.rs
+++ b/src/libstd/uv_iotask.rs
@@ -14,7 +14,6 @@
  * The I/O task runs in its own single-threaded scheduler.  By using the
  * `interact` function you can execute code in a uv callback.
  */
-#[forbid(deprecated_mode)];
 
 use ll = uv_ll;
 
diff --git a/src/libstd/workcache.rs b/src/libstd/workcache.rs
index 4e9df14419b..b828c4ef629 100644
--- a/src/libstd/workcache.rs
+++ b/src/libstd/workcache.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#[allow(deprecated_mode)];
+
 use json;
 use sha1;
 use serialize::{Encoder, Encodable, Decoder, Decodable};