]> git.lizzy.rs Git - rust.git/commitdiff
Abort on double-failure. #910
authorBrian Anderson <banderson@mozilla.com>
Fri, 3 Jan 2014 02:39:51 +0000 (18:39 -0800)
committerBrian Anderson <banderson@mozilla.com>
Fri, 3 Jan 2014 02:46:29 +0000 (18:46 -0800)
Previously this was an rtabort!, indicating a runtime bug. Promote
this to a more intentional abort and print a (slightly) more
informative error message.

Can't test this sense our test suite can't handle an abort exit.

doc/rust.md
src/libstd/rt/unwind.rs

index 37a8b391142254792153dc04cdfd2a8633a5ba15..ea592d1fde557eab1cfeddaedde63922b417a639 100644 (file)
@@ -3605,10 +3605,8 @@ failed destructor. Nonetheless, the outermost unwinding activity will continue
 until the stack is unwound and the task transitions to the *dead*
 state. There is no way to "recover" from task failure.  Once a task has
 temporarily suspended its unwinding in the *failing* state, failure
-occurring from within this destructor results in *hard* failure.  The
-unwinding procedure of hard failure frees resources but does not execute
-destructors.  The original (soft) failure is still resumed at the point where
-it was temporarily suspended.
+occurring from within this destructor results in *hard* failure.
+A hard failure currently results in the process aborting.
 
 A task in the *dead* state cannot transition to other states; it exists
 only to have its termination status inspected by other tasks, and/or to await
index 358df7260f4af6b500782855ae85fe0d3f3aa0cc..6be4ab97ee3e560a2e16104cdd10ffa00c44c703 100644 (file)
@@ -354,7 +354,13 @@ pub fn begin_unwind<M: Any + Send>(msg: M, file: &'static str, line: uint) -> !
             }
 
             if (*task).unwinder.unwinding {
-                rtabort!("unwinding again");
+                // If a task fails while it's already unwinding then we
+                // have limited options. Currently our preference is to
+                // just abort. In the future we may consider resuming
+                // unwinding or otherwise exiting the task cleanly.
+                rterrln!("task failed during unwinding (double-failure - total drag!)")
+                rterrln!("rust must abort now. so sorry.");
+                intrinsics::abort();
             }
         }