Decrement unkillable counter before failing

This commit is contained in:
Flaper Fesp 2013-08-20 02:10:53 +02:00
parent 5fc4045d78
commit 5e80e0cbf4
2 changed files with 5 additions and 3 deletions

View file

@ -648,7 +648,9 @@ impl Death {
#[inline]
pub fn allow_kill(&mut self, already_failing: bool) {
if self.unkillable == 0 {
fail!("illegal call of rekillable");
// we need to decrement the counter before failing.
self.unkillable -= 1;
fail!("Cannot enter a rekillable() block without a surrounding unkillable()");
}
self.unkillable -= 1;
if self.unkillable == 0 {

View file

@ -651,8 +651,8 @@ fn test_kill_unkillable_task() {
}
}
#[ignore(reason = "linked failure")]
#[test]
#[ignore(cfg(windows))]
fn test_kill_rekillable_task() {
use rt::test::*;
@ -672,8 +672,8 @@ fn test_kill_rekillable_task() {
}
#[test]
#[ignore(cfg(windows))]
#[should_fail]
#[ignore(cfg(windows))]
fn test_rekillable_not_nested() {
do rekillable {
// This should fail before