diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-11-01 11:20:01 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-11-01 11:58:25 -0700 |
| commit | b00449380f520deb65de26e654aeaba4561ee13f (patch) | |
| tree | a55600b9d01023cb19606c7432472ec7196e3988 /src/libstd/task/mod.rs | |
| parent | 61637439dcced37391f7896561c0feb7790626f3 (diff) | |
| download | rust-b00449380f520deb65de26e654aeaba4561ee13f.tar.gz rust-b00449380f520deb65de26e654aeaba4561ee13f.zip | |
Remove unnecessary unwind messages
Now that the type_id intrinsic is working across crates, all of these unnecessary messages can be removed to have the failure type for a task truly be ~Any and only ~Any
Diffstat (limited to 'src/libstd/task/mod.rs')
| -rw-r--r-- | src/libstd/task/mod.rs | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/libstd/task/mod.rs b/src/libstd/task/mod.rs index cdb70f00dfe..e75f8f6237f 100644 --- a/src/libstd/task/mod.rs +++ b/src/libstd/task/mod.rs @@ -60,8 +60,6 @@ use comm::{stream, Chan, GenericChan, GenericPort, Port, Peekable}; use result::{Result, Ok, Err}; use rt::in_green_task_context; use rt::local::Local; -use rt::task::{UnwindMessageAny, UnwindMessageLinked}; -use rt::task::{UnwindMessageStrStatic, UnwindMessageStrOwned}; use rt::task::{UnwindResult, Success, Failure}; use send_str::{SendStr, IntoSendStr}; use unstable::finally::Finally; @@ -90,30 +88,25 @@ pub type TaskResult = Result<(), ~Any>; pub struct LinkedFailure; -#[inline] -fn wrap_as_any(res: UnwindResult) -> TaskResult { - match res { - Success => Ok(()), - Failure(UnwindMessageAny(a)) => Err(a), - Failure(UnwindMessageLinked) => Err(~LinkedFailure as ~Any), - Failure(UnwindMessageStrOwned(s)) => Err(~s as ~Any), - Failure(UnwindMessageStrStatic(s)) => Err(~s as ~Any), - } -} - pub struct TaskResultPort { priv port: Port<UnwindResult> } +fn to_task_result(res: UnwindResult) -> TaskResult { + match res { + Success => Ok(()), Failure(a) => Err(a), + } +} + impl GenericPort<TaskResult> for TaskResultPort { #[inline] fn recv(&self) -> TaskResult { - wrap_as_any(self.port.recv()) + to_task_result(self.port.recv()) } #[inline] fn try_recv(&self) -> Option<TaskResult> { - self.port.try_recv().map(wrap_as_any) + self.port.try_recv().map(to_task_result) } } |
