Skip to content

Commit 239fb1f

Browse files
committed
auto merge of #11283 : brson/rust/doublefailure, r=alexcrichton
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. I consider this to close #910, and that we should open another issue about implementing less conservative semantics here.
2 parents 3dd7c49 + 649c648 commit 239fb1f

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

doc/rust.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -3605,10 +3605,8 @@ failed destructor. Nonetheless, the outermost unwinding activity will continue
36053605
until the stack is unwound and the task transitions to the *dead*
36063606
state. There is no way to "recover" from task failure. Once a task has
36073607
temporarily suspended its unwinding in the *failing* state, failure
3608-
occurring from within this destructor results in *hard* failure. The
3609-
unwinding procedure of hard failure frees resources but does not execute
3610-
destructors. The original (soft) failure is still resumed at the point where
3611-
it was temporarily suspended.
3608+
occurring from within this destructor results in *hard* failure.
3609+
A hard failure currently results in the process aborting.
36123610

36133611
A task in the *dead* state cannot transition to other states; it exists
36143612
only to have its termination status inspected by other tasks, and/or to await

src/libstd/rt/unwind.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,13 @@ pub fn begin_unwind<M: Any + Send>(msg: M, file: &'static str, line: uint) -> !
354354
}
355355

356356
if (*task).unwinder.unwinding {
357-
rtabort!("unwinding again");
357+
// If a task fails while it's already unwinding then we
358+
// have limited options. Currently our preference is to
359+
// just abort. In the future we may consider resuming
360+
// unwinding or otherwise exiting the task cleanly.
361+
rterrln!("task failed during unwinding (double-failure - total drag!)")
362+
rterrln!("rust must abort now. so sorry.");
363+
intrinsics::abort();
358364
}
359365
}
360366

0 commit comments

Comments
 (0)