diff --git a/src/libextra/future.rs b/src/libextra/future.rs
index 8f28be49782..640ced24bad 100644
--- a/src/libextra/future.rs
+++ b/src/libextra/future.rs
@@ -36,7 +36,7 @@ pub struct Future {
}
enum FutureState {
- Pending(~fn() -> A),
+ Pending(proc() -> A),
Evaluating,
Forced(A)
}
@@ -92,7 +92,7 @@ impl Future {
Future {state: Forced(val)}
}
- pub fn from_fn(f: ~fn() -> A) -> Future {
+ pub fn from_fn(f: proc() -> A) -> Future {
/*!
* Create a future from a function.
*
@@ -120,7 +120,7 @@ impl Future {
}
}
- pub fn spawn(blk: ~fn() -> A) -> Future {
+ pub fn spawn(blk: proc() -> A) -> Future {
/*!
* Create a future from a unique closure.
*
@@ -137,7 +137,7 @@ impl Future {
Future::from_port(port)
}
- pub fn spawn_with(v: B, blk: ~fn(B) -> A) -> Future {
+ pub fn spawn_with(v: B, blk: proc(B) -> A) -> Future {
/*!
* Create a future from a unique closure taking one argument.
*
diff --git a/src/libextra/task_pool.rs b/src/libextra/task_pool.rs
index f7db66dc4e0..2ee3daacf80 100644
--- a/src/libextra/task_pool.rs
+++ b/src/libextra/task_pool.rs
@@ -23,7 +23,7 @@ use std::vec;
#[cfg(test)] use std::task::SingleThreaded;
enum Msg {
- Execute(~fn(&T)),
+ Execute(proc(&T)),
Quit
}
@@ -49,7 +49,7 @@ impl TaskPool {
/// local data to be kept around in that task.
pub fn new(n_tasks: uint,
opt_sched_mode: Option,
- init_fn_factory: ~fn() -> ~fn(uint) -> T)
+ init_fn_factory: &fn() -> proc(uint) -> T)
-> TaskPool {
assert!(n_tasks >= 1);
@@ -57,7 +57,7 @@ impl TaskPool {
let (port, chan) = comm::stream::>();
let init_fn = init_fn_factory();
- let task_body: ~fn() = || {
+ let task_body: proc() = || {
let local_data = init_fn(i);
loop {
match port.recv() {
@@ -88,7 +88,7 @@ impl TaskPool {
/// Executes the function `f` on a task in the pool. The function
/// receives a reference to the local data returned by the `init_fn`.
- pub fn execute(&mut self, f: ~fn(&T)) {
+ pub fn execute(&mut self, f: proc(&T)) {
self.channels[self.next_index].send(Execute(f));
self.next_index += 1;
if self.next_index == self.channels.len() { self.next_index = 0; }
@@ -97,8 +97,8 @@ impl TaskPool {
#[test]
fn test_task_pool() {
- let f: ~fn() -> ~fn(uint) -> uint = || {
- let g: ~fn(uint) -> uint = |i| i;
+ let f: proc() -> proc(uint) -> uint = || {
+ let g: proc(uint) -> uint = |i| i;
g
};
let mut pool = TaskPool::new(4, Some(SingleThreaded), f);
diff --git a/src/libextra/test.rs b/src/libextra/test.rs
index 14fee38dada..acb3d538c98 100644
--- a/src/libextra/test.rs
+++ b/src/libextra/test.rs
@@ -74,6 +74,11 @@ impl TestDesc {
}
}
+/// Represents a benchmark function.
+pub trait TDynBenchFn {
+ fn run(&self, harness: &mut BenchHarness);
+}
+
// A function that runs a test. If the function returns successfully,
// 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
@@ -81,10 +86,10 @@ impl TestDesc {
pub enum TestFn {
StaticTestFn(extern fn()),
StaticBenchFn(extern fn(&mut BenchHarness)),
- StaticMetricFn(~fn(&mut MetricMap)),
- DynTestFn(~fn()),
- DynMetricFn(~fn(&mut MetricMap)),
- DynBenchFn(~fn(&mut BenchHarness))
+ StaticMetricFn(proc(&mut MetricMap)),
+ DynTestFn(proc()),
+ DynMetricFn(proc(&mut MetricMap)),
+ DynBenchFn(~TDynBenchFn)
}
impl TestFn {
@@ -859,7 +864,7 @@ pub fn run_test(force_ignore: bool,
fn run_test_inner(desc: TestDesc,
monitor_ch: SharedChan,
- testfn: ~fn()) {
+ testfn: proc()) {
let testfn_cell = ::std::cell::Cell::new(testfn);
do task::spawn {
let mut task = task::task();
@@ -878,8 +883,8 @@ pub fn run_test(force_ignore: bool,
}
match testfn {
- DynBenchFn(benchfn) => {
- let bs = ::test::bench::benchmark(benchfn);
+ DynBenchFn(bencher) => {
+ let bs = ::test::bench::benchmark(|harness| bencher.run(harness));
monitor_ch.send((desc, TrBench(bs)));
return;
}
diff --git a/src/libextra/workcache.rs b/src/libextra/workcache.rs
index 89e50f53ab4..02855eb9777 100644
--- a/src/libextra/workcache.rs
+++ b/src/libextra/workcache.rs
@@ -394,14 +394,14 @@ impl<'self> Prep<'self> {
pub fn exec +
Decodable>(
- &'self self, blk: ~fn(&mut Exec) -> T) -> T {
+ &'self self, blk: proc(&mut Exec) -> T) -> T {
self.exec_work(blk).unwrap()
}
fn exec_work +
Decodable>( // FIXME(#5121)
- &'self self, blk: ~fn(&mut Exec) -> T) -> Work<'self, T> {
+ &'self self, blk: proc(&mut Exec) -> T) -> Work<'self, T> {
let mut bo = Some(blk);
debug!("exec_work: looking up {} and {:?}", self.fn_name,