2012-04-09 15:54:51 -07:00
|
|
|
// error-pattern:ran out of stack
|
|
|
|
|
|
|
|
// Test that the task fails after hiting the recursion limit
|
2012-11-15 19:50:53 -08:00
|
|
|
// during unwinding
|
2012-04-09 15:54:51 -07:00
|
|
|
|
|
|
|
fn recurse() {
|
|
|
|
log(debug, "don't optimize me out");
|
|
|
|
recurse();
|
|
|
|
}
|
|
|
|
|
2012-11-15 19:50:53 -08:00
|
|
|
struct r {
|
|
|
|
recursed: *mut bool,
|
|
|
|
drop unsafe {
|
|
|
|
if !*(self.recursed) {
|
|
|
|
*(self.recursed) = true;
|
|
|
|
recurse();
|
|
|
|
}
|
2012-04-09 15:54:51 -07:00
|
|
|
}
|
2012-11-15 19:50:53 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
fn r(recursed: *mut bool) -> r unsafe {
|
|
|
|
r { recursed: recursed }
|
2012-04-09 15:54:51 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut recursed = false;
|
2012-11-15 19:50:53 -08:00
|
|
|
let _r = r(ptr::mut_addr_of(&recursed));
|
2012-04-09 15:54:51 -07:00
|
|
|
recurse();
|
|
|
|
}
|