diff options
Diffstat (limited to 'src/libstd/task.rs')
| -rw-r--r-- | src/libstd/task.rs | 20 | 
1 files changed, 11 insertions, 9 deletions
| diff --git a/src/libstd/task.rs b/src/libstd/task.rs index e9b01063f94..7c5e984ad36 100644 --- a/src/libstd/task.rs +++ b/src/libstd/task.rs @@ -41,6 +41,7 @@ use comm::{Sender, Receiver, channel}; use io::Writer; use kinds::{Send, marker}; use option::{None, Some, Option}; +use owned::Box; use result::{Result, Ok, Err}; use rt::local::Local; use rt::task::Task; @@ -56,7 +57,7 @@ use str::{Str, SendStr, IntoMaybeOwned}; /// /// If you wish for this result's delivery to block until all /// children tasks complete, recommend using a result future. -pub type TaskResult = Result<(), ~Any:Send>; +pub type TaskResult = Result<(), Box<Any:Send>>; /// Task configuration options pub struct TaskOpts { @@ -67,9 +68,9 @@ pub struct TaskOpts { /// The size of the stack for the spawned task pub stack_size: Option<uint>, /// Task-local stdout - pub stdout: Option<~Writer:Send>, + pub stdout: Option<Box<Writer:Send>>, /// Task-local stderr - pub stderr: Option<~Writer:Send>, + pub stderr: Option<Box<Writer:Send>>, } /** @@ -173,7 +174,7 @@ impl TaskBuilder { Some(gen) => gen(f), None => f }; - let t: ~Task = Local::take(); + let t: Box<Task> = Local::take(); t.spawn_sibling(self.opts, f); } @@ -190,7 +191,8 @@ impl TaskBuilder { * # Failure * Fails if a future_result was already set for this task. */ - pub fn try<T:Send>(mut self, f: proc():Send -> T) -> Result<T, ~Any:Send> { + pub fn try<T:Send>(mut self, f: proc():Send -> T) + -> Result<T, Box<Any:Send>> { let (tx, rx) = channel(); let result = self.future_result(); @@ -240,7 +242,7 @@ pub fn spawn(f: proc():Send) { /// the function or an error if the task failed /// /// This is equivalent to TaskBuilder::new().try -pub fn try<T:Send>(f: proc():Send -> T) -> Result<T, ~Any:Send> { +pub fn try<T:Send>(f: proc():Send -> T) -> Result<T, Box<Any:Send>> { TaskBuilder::new().try(f) } @@ -264,7 +266,7 @@ pub fn deschedule() { use rt::local::Local; // FIXME(#7544): Optimize this, since we know we won't block. - let task: ~Task = Local::take(); + let task: Box<Task> = Local::take(); task.yield_now(); } @@ -507,10 +509,10 @@ fn test_try_fail_message_owned_str() { #[test] fn test_try_fail_message_any() { match try(proc() { - fail!(box 413u16 as ~Any:Send); + fail!(box 413u16 as Box<Any:Send>); }) { Err(e) => { - type T = ~Any:Send; + type T = Box<Any:Send>; assert!(e.is::<T>()); let any = e.move::<T>().unwrap(); assert!(any.is::<u16>()); | 
