Don't make the runtime exit on illegal calls
This commit is contained in:
@@ -647,7 +647,9 @@ 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 {
|
||||
fail!("illegal call of rekillable");
|
||||
}
|
||||
self.unkillable -= 1;
|
||||
if self.unkillable == 0 {
|
||||
rtassert!(self.kill_handle.is_some());
|
||||
|
||||
@@ -671,7 +671,39 @@ fn test_kill_rekillable_task() {
|
||||
}
|
||||
}
|
||||
|
||||
#[test] #[should_fail]
|
||||
#[test]
|
||||
#[ignore(cfg(windows))]
|
||||
#[should_fail]
|
||||
fn test_rekillable_not_nested() {
|
||||
do rekillable {
|
||||
// This should fail before
|
||||
// receiving anything since
|
||||
// this block should be nested
|
||||
// into a unkillable block.
|
||||
yield();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[test]
|
||||
#[ignore(cfg(windows))]
|
||||
fn test_rekillable_nested_failure() {
|
||||
|
||||
let result = do task::try {
|
||||
do unkillable {
|
||||
do rekillable {
|
||||
let (port,chan) = comm::stream();
|
||||
do task::spawn { chan.send(()); fail!(); }
|
||||
port.recv(); // wait for child to exist
|
||||
port.recv(); // block forever, expect to get killed.
|
||||
}
|
||||
}
|
||||
};
|
||||
assert!(result.is_err());
|
||||
}
|
||||
|
||||
|
||||
#[test] #[should_fail] #[ignore(cfg(windows))]
|
||||
fn test_cant_dup_task_builder() {
|
||||
let mut builder = task();
|
||||
builder.unlinked();
|
||||
@@ -1239,20 +1271,6 @@ fn test_unkillable_nested() {
|
||||
po.recv();
|
||||
}
|
||||
|
||||
#[ignore(reason = "linked failure")]
|
||||
#[test]
|
||||
#[ignore(cfg(windows))]
|
||||
#[should_fail]
|
||||
fn test_rekillable_not_nested() {
|
||||
do rekillable {
|
||||
// This should fail before
|
||||
// receiving anything since
|
||||
// this block should be nested
|
||||
// into a unkillable block.
|
||||
yield();
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_child_doesnt_ref_parent() {
|
||||
// If the child refcounts the parent task, this will stack overflow when
|
||||
|
||||
2
src/llvm
2
src/llvm
Submodule src/llvm updated: 0964c68ddf...f67442eee2
Reference in New Issue
Block a user