diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-04-13 14:39:04 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-04-15 19:45:00 -0700 |
| commit | c836ff46215b743c0f681d3e4d799cde1832cde3 (patch) | |
| tree | d2d65dfca8f0683102c85ef3a287be374b1cf647 /src/libstd/task.rs | |
| parent | 326f938730c1eaae48ed333907dce2cc92dc9aab (diff) | |
std: Impl Deref/DerefMut for a borrowed task
Diffstat (limited to 'src/libstd/task.rs')
| -rw-r--r-- | src/libstd/task.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/libstd/task.rs b/src/libstd/task.rs index ed10f6d15cd..df627809ea0 100644 --- a/src/libstd/task.rs +++ b/src/libstd/task.rs @@ -257,8 +257,8 @@ pub fn try<T:Send>(f: proc():Send -> T) -> Result<T, ~Any:Send> { pub fn with_task_name<U>(blk: |Option<&str>| -> U) -> U { use rt::task::Task; - let mut task = Local::borrow(None::<Task>); - match task.get().name { + let task = Local::borrow(None::<Task>); + match task.name { Some(ref name) => blk(Some(name.as_slice())), None => blk(None) } @@ -276,11 +276,8 @@ pub fn deschedule() { pub fn failing() -> bool { //! True if the running task has failed - use rt::task::Task; - - let mut local = Local::borrow(None::<Task>); - local.get().unwinder.unwinding() + Local::borrow(None::<Task>).unwinder.unwinding() } // The following 8 tests test the following 2^3 combinations: |
