Allow fail messages to be caught, and introduce the Any trait
Some code cleanup, sorting of import blocks Removed std::unstable::UnsafeArc's use of Either Added run-fail tests for the new FailWithCause impls Changed future_result and try to return Result<(), ~Any>. - Internally, there is an enum of possible fail messages passend around. - In case of linked failure or a string message, the ~Any gets lazyly allocated in future_results recv method. - For that, future result now returns a wrapper around a Port. - Moved and renamed task::TaskResult into rt::task::UnwindResult and made it an internal enum. - Introduced a replacement typedef `type TaskResult = Result<(), ~Any>`.
This commit is contained in:
parent
cb5b21eba7
commit
fa8e71a825
24 changed files with 913 additions and 215 deletions
|
|
@ -918,7 +918,7 @@ mod tests {
|
|||
let m = Mutex::new();
|
||||
let m2 = m.clone();
|
||||
|
||||
let result: result::Result<(),()> = do task::try {
|
||||
let result: result::Result<(), ~Any> = do task::try {
|
||||
do m2.lock {
|
||||
fail!();
|
||||
}
|
||||
|
|
@ -935,7 +935,7 @@ mod tests {
|
|||
let m = Mutex::new();
|
||||
let m2 = m.clone();
|
||||
|
||||
let result: result::Result<(),()> = do task::try {
|
||||
let result: result::Result<(), ~Any> = do task::try {
|
||||
let (p, c) = comm::stream();
|
||||
do task::spawn || { // linked
|
||||
let _ = p.recv(); // wait for sibling to get in the mutex
|
||||
|
|
@ -963,7 +963,7 @@ mod tests {
|
|||
let m2 = m.clone();
|
||||
let (p, c) = comm::stream();
|
||||
|
||||
let result: result::Result<(),()> = do task::try {
|
||||
let result: result::Result<(), ~Any> = do task::try {
|
||||
let mut sibling_convos = ~[];
|
||||
do 2.times {
|
||||
let (p, c) = comm::stream();
|
||||
|
|
@ -1272,7 +1272,7 @@ mod tests {
|
|||
let x = RWLock::new();
|
||||
let x2 = x.clone();
|
||||
|
||||
let result: result::Result<(),()> = do task::try || {
|
||||
let result: result::Result<(), ~Any> = do task::try || {
|
||||
do lock_rwlock_in_mode(&x2, mode1) {
|
||||
fail!();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -873,8 +873,7 @@ pub fn run_test(force_ignore: bool,
|
|||
task.spawn(testfn_cell.take());
|
||||
|
||||
let task_result = result_future.recv();
|
||||
let test_result = calc_result(&desc,
|
||||
task_result == task::Success);
|
||||
let test_result = calc_result(&desc, task_result.is_ok());
|
||||
monitor_ch.send((desc.clone(), test_result));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue