From 50f9925fabbc738f7be0df8148c99fae3e975bb1 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Mon, 22 Oct 2012 16:22:47 -0700 Subject: [PATCH 1/7] core: Give future_pipe the same definition as pipes::oneshot --- src/libcore/future.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/libcore/future.rs b/src/libcore/future.rs index bc35dafde3526..8d4540605347d 100644 --- a/src/libcore/future.rs +++ b/src/libcore/future.rs @@ -67,7 +67,7 @@ pub fn from_value(val: A) -> Future { Future {state: Forced(~(move val))} } -pub fn from_port(port: future_pipe::client::waiting) -> +pub fn from_port(port: future_pipe::server::waiting) -> Future { /*! * Create a future from a port @@ -107,9 +107,15 @@ pub fn spawn(blk: fn~() -> A) -> Future { * value of the future. */ - from_port(pipes::spawn_service_recv(future_pipe::init, |move blk, ch| { - future_pipe::server::completed(move ch, blk()); - })) + let (chan, port) = future_pipe::init(); + + let chan = ~mut Some(move chan); + do task::spawn |move blk, move chan| { + let chan = option::swap_unwrap(&mut *chan); + future_pipe::client::completed(move chan, blk()); + } + + return from_port(move port); } pub fn get_ref(future: &r/Future) -> &r/A { @@ -163,7 +169,7 @@ pub fn with(future: &Future, blk: fn((&A)) -> B) -> B { } proto! future_pipe ( - waiting:recv { + waiting:send { completed(T) -> ! } ) @@ -178,8 +184,8 @@ pub mod test { #[test] pub fn test_from_port() { - let (po, ch) = future_pipe::init(); - future_pipe::server::completed(move ch, ~"whale"); + let (ch, po) = future_pipe::init(); + future_pipe::client::completed(move ch, ~"whale"); let f = from_port(move po); assert get(&f) == ~"whale"; } From 84c85496227e1b31f763dfd7e9a82c9b5da52407 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Mon, 22 Oct 2012 16:35:40 -0700 Subject: [PATCH 2/7] core: Replace future_pipe with pipe::oneshot --- src/libcore/future.rs | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/libcore/future.rs b/src/libcore/future.rs index 8d4540605347d..503e915cf8783 100644 --- a/src/libcore/future.rs +++ b/src/libcore/future.rs @@ -17,7 +17,7 @@ */ use either::Either; -use pipes::recv; +use pipes::{recv, oneshot, ChanOne, PortOne, send_one, recv_one}; use cast::copy_lifetime; #[doc = "The future type"] @@ -67,7 +67,7 @@ pub fn from_value(val: A) -> Future { Future {state: Forced(~(move val))} } -pub fn from_port(port: future_pipe::server::waiting) -> +pub fn from_port(port: PortOne) -> Future { /*! * Create a future from a port @@ -82,7 +82,7 @@ pub fn from_port(port: future_pipe::server::waiting) -> port_ <-> *port; let port = option::unwrap(move port_); match recv(move port) { - future_pipe::completed(move data) => move data + oneshot::send(move data) => move data } } } @@ -107,12 +107,12 @@ pub fn spawn(blk: fn~() -> A) -> Future { * value of the future. */ - let (chan, port) = future_pipe::init(); + let (chan, port) = oneshot::init(); let chan = ~mut Some(move chan); do task::spawn |move blk, move chan| { let chan = option::swap_unwrap(&mut *chan); - future_pipe::client::completed(move chan, blk()); + send_one(move chan, blk()); } return from_port(move port); @@ -168,12 +168,6 @@ pub fn with(future: &Future, blk: fn((&A)) -> B) -> B { blk(get_ref(future)) } -proto! future_pipe ( - waiting:send { - completed(T) -> ! - } -) - #[allow(non_implicitly_copyable_typarams)] pub mod test { #[test] @@ -184,8 +178,8 @@ pub mod test { #[test] pub fn test_from_port() { - let (ch, po) = future_pipe::init(); - future_pipe::client::completed(move ch, ~"whale"); + let (ch, po) = oneshot::init(); + send_one(move ch, ~"whale"); let f = from_port(move po); assert get(&f) == ~"whale"; } From b6bde885dc276b2fab3dd0b2de98627dcc304026 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Mon, 22 Oct 2012 17:00:24 -0700 Subject: [PATCH 3/7] core: Use less code for option dancing that notification channel --- src/libcore/task.rs | 45 ++++++++------------------------------------- 1 file changed, 8 insertions(+), 37 deletions(-) diff --git a/src/libcore/task.rs b/src/libcore/task.rs index d9e213c7f55e8..37ee9ddf96bd2 100644 --- a/src/libcore/task.rs +++ b/src/libcore/task.rs @@ -32,6 +32,7 @@ use cmp::Eq; use result::Result; use pipes::{stream, Chan, Port}; use local_data_priv::{local_get, local_set}; +use util::replace; use rt::task_id; use rt::rust_task; @@ -246,11 +247,7 @@ priv impl TaskBuilder { fail ~"Cannot copy a task_builder"; // Fake move mode on self } self.consumed = true; - let notify_chan = if self.opts.notify_chan.is_none() { - None - } else { - Some(option::swap_unwrap(&mut self.opts.notify_chan)) - }; + let notify_chan = replace(&mut self.opts.notify_chan, None); TaskBuilder({ opts: { linked: self.opts.linked, @@ -271,11 +268,7 @@ impl TaskBuilder { * the other will not be killed. */ fn unlinked() -> TaskBuilder { - let notify_chan = if self.opts.notify_chan.is_none() { - None - } else { - Some(option::swap_unwrap(&mut self.opts.notify_chan)) - }; + let notify_chan = replace(&mut self.opts.notify_chan, None); TaskBuilder({ opts: { linked: false, @@ -293,11 +286,7 @@ impl TaskBuilder { * the child. */ fn supervised() -> TaskBuilder { - let notify_chan = if self.opts.notify_chan.is_none() { - None - } else { - Some(option::swap_unwrap(&mut self.opts.notify_chan)) - }; + let notify_chan = replace(&mut self.opts.notify_chan, None); TaskBuilder({ opts: { linked: false, @@ -314,11 +303,7 @@ impl TaskBuilder { * other will be killed. */ fn linked() -> TaskBuilder { - let notify_chan = if self.opts.notify_chan.is_none() { - None - } else { - Some(option::swap_unwrap(&mut self.opts.notify_chan)) - }; + let notify_chan = replace(&mut self.opts.notify_chan, None); TaskBuilder({ opts: { linked: true, @@ -381,11 +366,7 @@ impl TaskBuilder { } /// Configure a custom scheduler mode for the task. fn sched_mode(mode: SchedMode) -> TaskBuilder { - let notify_chan = if self.opts.notify_chan.is_none() { - None - } else { - Some(option::swap_unwrap(&mut self.opts.notify_chan)) - }; + let notify_chan = replace(&mut self.opts.notify_chan, None); TaskBuilder({ opts: { linked: self.opts.linked, @@ -412,11 +393,7 @@ impl TaskBuilder { */ fn add_wrapper(wrapper: fn@(v: fn~()) -> fn~()) -> TaskBuilder { let prev_gen_body = self.gen_body; - let notify_chan = if self.opts.notify_chan.is_none() { - None - } else { - Some(option::swap_unwrap(&mut self.opts.notify_chan)) - }; + let notify_chan = replace(&mut self.opts.notify_chan, None); TaskBuilder({ opts: { linked: self.opts.linked, @@ -447,13 +424,7 @@ impl TaskBuilder { * must be greater than zero. */ fn spawn(f: fn~()) { - let notify_chan = if self.opts.notify_chan.is_none() { - None - } else { - let swapped_notify_chan = - option::swap_unwrap(&mut self.opts.notify_chan); - Some(move swapped_notify_chan) - }; + let notify_chan = replace(&mut self.opts.notify_chan, None); let x = self.consume(); let opts = { linked: x.opts.linked, From f6d2a7143629898aebea58db836eb2009e97d067 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Mon, 22 Oct 2012 17:45:20 -0700 Subject: [PATCH 4/7] core: Remove the unused Notification enum --- src/libcore/task.rs | 27 +++------------------------ src/libcore/task/spawn.rs | 22 ++++++++-------------- 2 files changed, 11 insertions(+), 38 deletions(-) diff --git a/src/libcore/task.rs b/src/libcore/task.rs index 37ee9ddf96bd2..3bfa41f1c482a 100644 --- a/src/libcore/task.rs +++ b/src/libcore/task.rs @@ -73,25 +73,6 @@ impl TaskResult : Eq { pure fn ne(other: &TaskResult) -> bool { !self.eq(other) } } -/// A message type for notifying of task lifecycle events -pub enum Notification { - /// Sent when a task exits with the task handle and result - Exit(Task, TaskResult) -} - -impl Notification : cmp::Eq { - pure fn eq(other: &Notification) -> bool { - match self { - Exit(e0a, e1a) => { - match (*other) { - Exit(e0b, e1b) => e0a == e0b && e1a == e1b - } - } - } - } - pure fn ne(other: &Notification) -> bool { !self.eq(other) } -} - /// Scheduler modes pub enum SchedMode { /// All tasks run in the same OS thread @@ -201,7 +182,7 @@ pub type SchedOpts = { pub type TaskOpts = { linked: bool, supervised: bool, - mut notify_chan: Option>, + mut notify_chan: Option>, sched: Option, }; @@ -344,12 +325,10 @@ impl TaskBuilder { } // Construct the future and give it to the caller. - let (notify_pipe_ch, notify_pipe_po) = stream::(); + let (notify_pipe_ch, notify_pipe_po) = stream::(); blk(do future::from_fn |move notify_pipe_po| { - match notify_pipe_po.recv() { - Exit(_, result) => result - } + notify_pipe_po.recv() }); // Reconfigure self to use a notify channel. diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs index 6fbb572df41e1..ea66776d22d66 100644 --- a/src/libcore/task/spawn.rs +++ b/src/libcore/task/spawn.rs @@ -320,15 +320,15 @@ fn TCB(me: *rust_task, tasks: TaskGroupArc, ancestors: AncestorList, } struct AutoNotify { - notify_chan: Chan, + notify_chan: Chan, mut failed: bool, drop { let result = if self.failed { Failure } else { Success }; - self.notify_chan.send(Exit(get_task(), result)); + self.notify_chan.send(result); } } -fn AutoNotify(chan: Chan) -> AutoNotify { +fn AutoNotify(chan: Chan) -> AutoNotify { AutoNotify { notify_chan: move chan, failed: true // Un-set above when taskgroup successfully made. @@ -532,7 +532,7 @@ pub fn spawn_raw(opts: TaskOpts, f: fn~()) { // (4) ...and runs the provided body function. fn make_child_wrapper(child: *rust_task, child_arc: TaskGroupArc, ancestors: AncestorList, is_main: bool, - notify_chan: Option>, + notify_chan: Option>, f: fn~()) -> fn~() { let child_data = ~mut Some((move child_arc, move ancestors)); return fn~(move notify_chan, move child_data, move f) { @@ -660,25 +660,21 @@ fn test_spawn_raw_unsupervise() { #[test] #[ignore(cfg(windows))] fn test_spawn_raw_notify_success() { - let (task_ch, task_po) = pipes::stream(); let (notify_ch, notify_po) = pipes::stream(); let opts = { notify_chan: Some(move notify_ch), .. default_task_opts() }; - do spawn_raw(move opts) |move task_ch| { - task_ch.send(get_task()); + do spawn_raw(move opts) { } - let task_ = task_po.recv(); - assert notify_po.recv() == Exit(task_, Success); + assert notify_po.recv() == Success; } #[test] #[ignore(cfg(windows))] fn test_spawn_raw_notify_failure() { // New bindings for these - let (task_ch, task_po) = pipes::stream(); let (notify_ch, notify_po) = pipes::stream(); let opts = { @@ -686,10 +682,8 @@ fn test_spawn_raw_notify_failure() { notify_chan: Some(move notify_ch), .. default_task_opts() }; - do spawn_raw(move opts) |move task_ch| { - task_ch.send(get_task()); + do spawn_raw(move opts) { fail; } - let task_ = task_po.recv(); - assert notify_po.recv() == Exit(task_, Failure); + assert notify_po.recv() == Failure; } From 3e4b2bd2b2f48c98dab73c67b0ddf25a80129a3c Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Mon, 22 Oct 2012 19:01:37 -0700 Subject: [PATCH 5/7] core: Use PortOne instead of Future in future_result --- src/libcore/private.rs | 4 ++-- src/libcore/task.rs | 12 +++++------- src/libstd/arc.rs | 2 +- src/libstd/test.rs | 2 +- src/test/bench/msgsend-pipes-shared.rs | 2 +- src/test/bench/msgsend-pipes.rs | 2 +- src/test/bench/msgsend.rs | 2 +- src/test/bench/shootout-pfib.rs | 2 +- src/test/bench/task-perf-linked-failure.rs | 2 +- src/test/run-pass/task-comm-12.rs | 2 +- src/test/run-pass/task-comm-3.rs | 2 +- src/test/run-pass/task-comm-9.rs | 2 +- src/test/run-pass/task-comm.rs | 4 ++-- src/test/run-pass/yield.rs | 2 +- src/test/run-pass/yield1.rs | 2 +- 15 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/libcore/private.rs b/src/libcore/private.rs index c4298d572b6fd..e7e9de39ccdb4 100644 --- a/src/libcore/private.rs +++ b/src/libcore/private.rs @@ -642,7 +642,7 @@ pub mod tests { // Have to get rid of our reference before blocking. { let _x = move x; } // FIXME(#3161) util::ignore doesn't work here let res = option::swap_unwrap(&mut res); - future::get(&res); + res.recv(); } #[test] #[should_fail] #[ignore(cfg(windows))] @@ -657,7 +657,7 @@ pub mod tests { } assert unwrap_exclusive(move x) == ~~"hello"; let res = option::swap_unwrap(&mut res); - future::get(&res); + res.recv(); } #[test] #[ignore(cfg(windows))] diff --git a/src/libcore/task.rs b/src/libcore/task.rs index 3bfa41f1c482a..9a1d8cf39a834 100644 --- a/src/libcore/task.rs +++ b/src/libcore/task.rs @@ -314,7 +314,7 @@ impl TaskBuilder { * # Failure * Fails if a future_result was already set for this task. */ - fn future_result(blk: fn(v: future::Future)) -> TaskBuilder { + fn future_result(blk: fn(v: Port)) -> TaskBuilder { // FIXME (#3725): Once linked failure and notification are // handled in the library, I can imagine implementing this by just // registering an arbitrary number of task::on_exit handlers and @@ -327,9 +327,7 @@ impl TaskBuilder { // Construct the future and give it to the caller. let (notify_pipe_ch, notify_pipe_po) = stream::(); - blk(do future::from_fn |move notify_pipe_po| { - notify_pipe_po.recv() - }); + blk(move notify_pipe_po); // Reconfigure self to use a notify channel. TaskBuilder({ @@ -482,7 +480,7 @@ impl TaskBuilder { do fr_task_builder.spawn |move f| { comm::send(ch, f()); } - match future::get(&option::unwrap(move result)) { + match option::unwrap(move result).recv() { Success => result::Ok(comm::recv(po)), Failure => result::Err(()) } @@ -899,14 +897,14 @@ fn test_add_wrapper() { fn test_future_result() { let mut result = None; do task().future_result(|+r| { result = Some(move r); }).spawn { } - assert future::get(&option::unwrap(move result)) == Success; + assert option::unwrap(move result).recv() == Success; result = None; do task().future_result(|+r| { result = Some(move r); }).unlinked().spawn { fail; } - assert future::get(&option::unwrap(move result)) == Failure; + assert option::unwrap(move result).recv() == Failure; } #[test] #[should_fail] #[ignore(cfg(windows))] diff --git a/src/libstd/arc.rs b/src/libstd/arc.rs index 2f4c9a4eb06f4..0033a4eaccd07 100644 --- a/src/libstd/arc.rs +++ b/src/libstd/arc.rs @@ -651,7 +651,7 @@ mod tests { } // Wait for children to pass their asserts - for vec::each(children) |r| { future::get(r); } + for vec::each(children) |r| { r.recv(); } // Wait for writer to finish p.recv(); diff --git a/src/libstd/test.rs b/src/libstd/test.rs index ca83dbf17ed13..b5fef604c5889 100644 --- a/src/libstd/test.rs +++ b/src/libstd/test.rs @@ -391,7 +391,7 @@ fn run_test(test: TestDesc, monitor_ch: comm::Chan) { task::task().unlinked().future_result(|+r| { result_future = Some(move r); }).spawn(move testfn); - let task_result = future::get(&option::unwrap(move result_future)); + let task_result = option::unwrap(move result_future).recv(); let test_result = calc_result(&test, task_result == task::Success); comm::send(monitor_ch, (copy test, test_result)); }; diff --git a/src/test/bench/msgsend-pipes-shared.rs b/src/test/bench/msgsend-pipes-shared.rs index da891b376e302..55afa0490918c 100644 --- a/src/test/bench/msgsend-pipes-shared.rs +++ b/src/test/bench/msgsend-pipes-shared.rs @@ -74,7 +74,7 @@ fn run(args: &[~str]) { } for vec::each(worker_results) |r| { - future::get(r); + r.recv(); } //error!("sending stop message"); diff --git a/src/test/bench/msgsend-pipes.rs b/src/test/bench/msgsend-pipes.rs index 041094adcd50d..f0fc1dd5f001b 100644 --- a/src/test/bench/msgsend-pipes.rs +++ b/src/test/bench/msgsend-pipes.rs @@ -71,7 +71,7 @@ fn run(args: &[~str]) { } for vec::each(worker_results) |r| { - future::get(r); + r.recv(); } //error!("sending stop message"); diff --git a/src/test/bench/msgsend.rs b/src/test/bench/msgsend.rs index 6ab22779c55f1..143d4d86d0d56 100644 --- a/src/test/bench/msgsend.rs +++ b/src/test/bench/msgsend.rs @@ -45,7 +45,7 @@ fn run(args: ~[~str]) { }; } for vec::each(worker_results) |r| { - future::get(r); + r.recv(); } comm::send(to_child, stop); let result = comm::recv(from_child); diff --git a/src/test/bench/shootout-pfib.rs b/src/test/bench/shootout-pfib.rs index a776c1322d380..e70b796298be8 100644 --- a/src/test/bench/shootout-pfib.rs +++ b/src/test/bench/shootout-pfib.rs @@ -78,7 +78,7 @@ fn stress(num_tasks: int) { stress_task(i); } } - for results.each |r| { future::get(r); } + for results.each |r| { r.recv(); } } fn main() { diff --git a/src/test/bench/task-perf-linked-failure.rs b/src/test/bench/task-perf-linked-failure.rs index f148d595f9d5a..b0bc92797c9a1 100644 --- a/src/test/bench/task-perf-linked-failure.rs +++ b/src/test/bench/task-perf-linked-failure.rs @@ -33,7 +33,7 @@ fn spawn_supervised_blocking(myname: &str, +f: fn~()) { let mut res = None; task::task().future_result(|+r| res = Some(move r)).supervised().spawn(move f); error!("%s group waiting", myname); - let x = future::get(&option::unwrap(move res)); + let x = option::unwrap(move res).recv(); assert x == task::Success; } diff --git a/src/test/run-pass/task-comm-12.rs b/src/test/run-pass/task-comm-12.rs index 64ea3fb9d0e59..59cbd26204e93 100644 --- a/src/test/run-pass/task-comm-12.rs +++ b/src/test/run-pass/task-comm-12.rs @@ -19,7 +19,7 @@ fn test00() { } // Try joining tasks that have already finished. - future::get(&option::unwrap(move result)); + option::unwrap(move result).recv(); debug!("Joined task."); } diff --git a/src/test/run-pass/task-comm-3.rs b/src/test/run-pass/task-comm-3.rs index 7082cd55ac832..b34eff7c30b10 100644 --- a/src/test/run-pass/task-comm-3.rs +++ b/src/test/run-pass/task-comm-3.rs @@ -53,7 +53,7 @@ fn test00() { } // Join spawned tasks... - for results.each |r| { future::get(r); } + for results.each |r| { r.recv(); } debug!("Completed: Final number is: "); log(error, sum); diff --git a/src/test/run-pass/task-comm-9.rs b/src/test/run-pass/task-comm-9.rs index 5ed5899658d24..c8bd043a182f0 100644 --- a/src/test/run-pass/task-comm-9.rs +++ b/src/test/run-pass/task-comm-9.rs @@ -30,7 +30,7 @@ fn test00() { i += 1; } - future::get(&option::unwrap(move result)); + option::unwrap(move result).recv(); assert (sum == number_of_messages * (number_of_messages - 1) / 2); } diff --git a/src/test/run-pass/task-comm.rs b/src/test/run-pass/task-comm.rs index aba0bd6600525..d1548de5a6dd1 100644 --- a/src/test/run-pass/task-comm.rs +++ b/src/test/run-pass/task-comm.rs @@ -51,7 +51,7 @@ fn test00() { while i < number_of_messages { sum += recv(po); i = i + 1; } } - for results.each |r| { future::get(r); } + for results.each |r| { r.recv(); } debug!("Completed: Final number is: "); assert (sum == @@ -134,7 +134,7 @@ fn test06() { } - for results.each |r| { future::get(r); } + for results.each |r| { r.recv(); } } diff --git a/src/test/run-pass/yield.rs b/src/test/run-pass/yield.rs index 11208a969db2a..0ef4d088f9ccc 100644 --- a/src/test/run-pass/yield.rs +++ b/src/test/run-pass/yield.rs @@ -10,7 +10,7 @@ fn main() { error!("2"); yield(); error!("3"); - future::get(&option::unwrap(move result)); + option::unwrap(move result).recv(); } fn child() { diff --git a/src/test/run-pass/yield1.rs b/src/test/run-pass/yield1.rs index ec77a68632450..0a6a79682247c 100644 --- a/src/test/run-pass/yield1.rs +++ b/src/test/run-pass/yield1.rs @@ -7,7 +7,7 @@ fn main() { task::task().future_result(|+r| { result = Some(move r); }).spawn(child); error!("1"); yield(); - future::get(&option::unwrap(move result)); + option::unwrap(move result).recv(); } fn child() { error!("2"); } From f500f3f1fb4092bf7993170d755377268943e94b Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Mon, 22 Oct 2012 19:16:52 -0700 Subject: [PATCH 6/7] core: Remove remaining use of Future --- src/libcore/private.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/libcore/private.rs b/src/libcore/private.rs index e7e9de39ccdb4..a65e0ae1bb12b 100644 --- a/src/libcore/private.rs +++ b/src/libcore/private.rs @@ -581,16 +581,20 @@ pub mod tests { for uint::range(0, num_tasks) |_i| { let total = total.clone(); - futures.push(future::spawn(|move total| { + let (chan, port) = pipes::stream(); + futures.push(move port); + + do task::spawn |move total, move chan| { for uint::range(0, count) |_i| { do total.with |count| { **count += 1; } } - })); + chan.send(()); + } }; - for futures.each |f| { f.get() } + for futures.each |f| { f.recv() } do total.with |total| { assert **total == num_tasks * count From d29962f0eb2772c208a299efae86ad16bc25f7de Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Tue, 23 Oct 2012 14:20:57 -0700 Subject: [PATCH 7/7] Move futures to std --- src/libcore/core.rc | 1 - src/{libcore => libstd}/future.rs | 0 src/libstd/std.rc | 1 + src/rustdoc/markdown_writer.rs | 1 + src/test/bench/msgsend-ring-mutex-arcs.rs | 3 +-- src/test/bench/msgsend-ring-pipes.rs | 3 +-- src/test/bench/msgsend-ring-rw-arcs.rs | 3 +-- src/test/bench/msgsend-ring.rs | 2 +- 8 files changed, 6 insertions(+), 8 deletions(-) rename src/{libcore => libstd}/future.rs (100%) diff --git a/src/libcore/core.rc b/src/libcore/core.rc index 9ebdad3521e53..c0852e663205f 100644 --- a/src/libcore/core.rc +++ b/src/libcore/core.rc @@ -181,7 +181,6 @@ pub mod task { pub mod spawn; pub mod rt; } -pub mod future; pub mod pipes; // Runtime and language-primitive support diff --git a/src/libcore/future.rs b/src/libstd/future.rs similarity index 100% rename from src/libcore/future.rs rename to src/libstd/future.rs diff --git a/src/libstd/std.rc b/src/libstd/std.rc index bbffde409484e..0c48cd7ce0061 100644 --- a/src/libstd/std.rc +++ b/src/libstd/std.rc @@ -53,6 +53,7 @@ pub mod cell; pub mod sync; pub mod arc; pub mod comm; +pub mod future; // Collections diff --git a/src/rustdoc/markdown_writer.rs b/src/rustdoc/markdown_writer.rs index 1ed007def6334..99185fb15bfed 100644 --- a/src/rustdoc/markdown_writer.rs +++ b/src/rustdoc/markdown_writer.rs @@ -1,5 +1,6 @@ use doc::ItemUtils; use io::ReaderUtil; +use std::future; export WriteInstr; export Writer; diff --git a/src/test/bench/msgsend-ring-mutex-arcs.rs b/src/test/bench/msgsend-ring-mutex-arcs.rs index ac0043b7309f5..82b8e2410a964 100644 --- a/src/test/bench/msgsend-ring-mutex-arcs.rs +++ b/src/test/bench/msgsend-ring-mutex-arcs.rs @@ -7,11 +7,10 @@ // xfail-pretty -use future::future; - extern mod std; use std::time; use std::arc; +use std::future; // A poor man's pipe. type pipe = arc::MutexARC<~[uint]>; diff --git a/src/test/bench/msgsend-ring-pipes.rs b/src/test/bench/msgsend-ring-pipes.rs index 85e46bfcaec26..de4332b692a1a 100644 --- a/src/test/bench/msgsend-ring-pipes.rs +++ b/src/test/bench/msgsend-ring-pipes.rs @@ -8,10 +8,9 @@ // xfail-pretty -use future::future; - extern mod std; use std::time; +use std::future; use pipes::recv; diff --git a/src/test/bench/msgsend-ring-rw-arcs.rs b/src/test/bench/msgsend-ring-rw-arcs.rs index f5c6a49a3646f..375ff8f50d866 100644 --- a/src/test/bench/msgsend-ring-rw-arcs.rs +++ b/src/test/bench/msgsend-ring-rw-arcs.rs @@ -7,11 +7,10 @@ // xfail-pretty -use future::future; - extern mod std; use std::time; use std::arc; +use std::future; // A poor man's pipe. type pipe = arc::RWARC<~[uint]>; diff --git a/src/test/bench/msgsend-ring.rs b/src/test/bench/msgsend-ring.rs index 5cb278b0dd2e3..343f50127b596 100644 --- a/src/test/bench/msgsend-ring.rs +++ b/src/test/bench/msgsend-ring.rs @@ -5,10 +5,10 @@ // message path. use comm::*; -use future::future; extern mod std; use std::time; +use std::future; fn thread_ring(i: uint, count: uint,