Skip to content

Commit c4093b4

Browse files
committed
Testing rekillable fails when called from outside an unkillable block
1 parent cd92d2c commit c4093b4

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/libstd/task/mod.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,8 @@ pub fn unkillable<U>(f: &fn() -> U) -> U {
598598
}
599599

600600
/**
601-
* Makes killable a task marked as unkillable
601+
* Makes killable a task marked as unkillable. This
602+
* is meant to be used only nested in unkillable.
602603
*
603604
* # Example
604605
*
@@ -607,6 +608,7 @@ pub fn unkillable<U>(f: &fn() -> U) -> U {
607608
* do task::rekillable {
608609
* // Task is killable
609610
* }
611+
* // Task is unkillable again
610612
* }
611613
*/
612614
pub fn rekillable<U>(f: &fn() -> U) -> U {
@@ -1237,6 +1239,20 @@ fn test_unkillable_nested() {
12371239
po.recv();
12381240
}
12391241

1242+
#[ignore(reason = "linked failure")]
1243+
#[test]
1244+
#[ignore(cfg(windows))]
1245+
#[should_fail]
1246+
fn test_rekillable_not_nested() {
1247+
do rekillable {
1248+
// This should fail before
1249+
// receiving anything since
1250+
// this block should be nested
1251+
// into a unkillable block.
1252+
yield();
1253+
}
1254+
}
1255+
12401256
#[test]
12411257
fn test_child_doesnt_ref_parent() {
12421258
// If the child refcounts the parent task, this will stack overflow when

0 commit comments

Comments
 (0)