From 5e80e0cbf415219bb4fb483a24bd8cc03836d315 Mon Sep 17 00:00:00 2001 From: Flaper Fesp Date: Tue, 20 Aug 2013 02:10:53 +0200 Subject: [PATCH] Decrement unkillable counter before failing --- src/libstd/rt/kill.rs | 4 +++- src/libstd/task/mod.rs | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libstd/rt/kill.rs b/src/libstd/rt/kill.rs index afef699390b7..94df621ce766 100644 --- a/src/libstd/rt/kill.rs +++ b/src/libstd/rt/kill.rs @@ -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 { diff --git a/src/libstd/task/mod.rs b/src/libstd/task/mod.rs index d094623b57ba..74e1af540c0a 100644 --- a/src/libstd/task/mod.rs +++ b/src/libstd/task/mod.rs @@ -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