std: Impl Deref/DerefMut for a borrowed task

This commit is contained in:
Alex Crichton
2014-04-13 14:39:04 -07:00
parent 326f938730
commit c836ff4621
5 changed files with 20 additions and 26 deletions

View File

@@ -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: