Don't make the runtime exit on illegal calls
This commit is contained in:
parent
c4093b4a83
commit
5fc4045d78
3 changed files with 37 additions and 17 deletions
|
|
@ -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
|
|
@ -1 +1 @@
|
|||
Subproject commit 0964c68ddf2c67ce455e7443a06f4bb3db9e92bb
|
||||
Subproject commit f67442eee27d3d075a65cf7f9a70f7ec6649ffd1
|
||||
Loading…
Add table
Add a link
Reference in a new issue