about summary refs log tree commit diff
path: root/src/libstd/rt
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-08-27 11:35:51 -0700
committerbors <bors@rust-lang.org>2013-08-27 11:35:51 -0700
commitc822d1070ac39871165df30ac8d09e733a6e7fb9 (patch)
tree10a9f4f2282ba97a33ecde8d45984183608fafb6 /src/libstd/rt
parent7841b77676662ed657da7b8911dd0989ac743ca0 (diff)
parentcc59d9609740bd325a796ba0831af15b87f502ed (diff)
downloadrust-c822d1070ac39871165df30ac8d09e733a6e7fb9.tar.gz
rust-c822d1070ac39871165df30ac8d09e733a6e7fb9.zip
auto merge of #8581 : FlaPer87/rust/issue/8232, r=bblum
As for now, rekillable is an unsafe function, instead, it should behave
just like unkillable by encapsulating unsafe code within an unsafe
block.

This patch does that and removes unsafe blocks that were encapsulating
rekillable calls throughout rust's libs.

Fixes #8232
Diffstat (limited to 'src/libstd/rt')
-rw-r--r--src/libstd/rt/kill.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libstd/rt/kill.rs b/src/libstd/rt/kill.rs
index b0b425e3aee..94df621ce76 100644
--- a/src/libstd/rt/kill.rs
+++ b/src/libstd/rt/kill.rs
@@ -647,7 +647,11 @@ impl Death {
     /// All calls must be paired with a preceding call to inhibit_kill.
     #[inline]
     pub fn allow_kill(&mut self, already_failing: bool) {
-        rtassert!(self.unkillable != 0);
+        if self.unkillable == 0 {
+            // 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 {
             rtassert!(self.kill_handle.is_some());