2012-12-10 17:32:48 -08:00
|
|
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2012-11-16 11:19:45 -08:00
|
|
|
// xfail-test leaks
|
2012-04-09 15:54:51 -07:00
|
|
|
// error-pattern:ran out of stack
|
|
|
|
|
2013-05-09 02:34:47 +09:00
|
|
|
// Test that the task fails after hitting the recursion limit
|
2012-11-15 19:50:53 -08:00
|
|
|
// during unwinding
|
2012-04-09 15:54:51 -07:00
|
|
|
|
|
|
|
fn recurse() {
|
2013-07-23 18:55:15 +10:00
|
|
|
info!("don't optimize me out");
|
2012-04-09 15:54:51 -07:00
|
|
|
recurse();
|
|
|
|
}
|
|
|
|
|
2012-11-15 19:50:53 -08:00
|
|
|
struct r {
|
|
|
|
recursed: *mut bool,
|
2013-02-27 19:13:53 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Drop for r {
|
2013-06-20 21:06:13 -04:00
|
|
|
fn drop(&self) {
|
2013-01-23 11:43:58 -08:00
|
|
|
unsafe {
|
|
|
|
if !*(self.recursed) {
|
|
|
|
*(self.recursed) = true;
|
|
|
|
recurse();
|
|
|
|
}
|
2012-11-15 19:50:53 -08:00
|
|
|
}
|
2012-04-09 15:54:51 -07:00
|
|
|
}
|
2012-11-15 19:50:53 -08:00
|
|
|
}
|
|
|
|
|
2013-01-23 11:43:58 -08:00
|
|
|
fn r(recursed: *mut bool) -> r {
|
2013-07-23 18:55:15 +10:00
|
|
|
r { recursed: recursed }
|
2012-04-09 15:54:51 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut recursed = false;
|
2013-02-14 19:00:04 -05:00
|
|
|
let _r = r(&mut recursed);
|
2012-04-09 15:54:51 -07:00
|
|
|
recurse();
|
2013-01-23 11:43:58 -08:00
|
|
|
}
|