diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index 3933692f0155..6c79ef3264a8 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -178,7 +178,10 @@ rust_task::~rust_task() I(sched, ref_count == 0); // || // (ref_count == 1 && this == sched->root_task)); - del_stk(this, stk); + // Delete all the stacks. There may be more than one if the task failed + while (stk != NULL) { + del_stk(this, stk); + } } struct spawn_args { diff --git a/src/test/run-fail/morestack1.rs b/src/test/run-fail/morestack1.rs index 3a437d7d859a..fb64630b7004 100644 --- a/src/test/run-fail/morestack1.rs +++ b/src/test/run-fail/morestack1.rs @@ -1,5 +1,6 @@ // xfail-test // compile-flags:--stack-growth +// error-pattern:explicit failure fn getbig(i: int) { if i != 0 { getbig(i - 1); @@ -9,5 +10,5 @@ fn getbig(i: int) { } fn main() { - getbig(10000000); + getbig(100000); } \ No newline at end of file