]> git.lizzy.rs Git - rust.git/blob - src/test/run-fail/morestack4.rs
Change finalize -> drop.
[rust.git] / src / test / run-fail / morestack4.rs
1 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // error-pattern:explicit failure
12
13 // Just testing unwinding
14
15 extern mod extra;
16
17 use std::task;
18
19 fn getbig_and_fail(i: int) {
20     let r = and_then_get_big_again(5);
21     if i != 0 {
22         getbig_and_fail(i - 1);
23     } else {
24         fail!();
25     }
26 }
27
28 struct and_then_get_big_again {
29   x:int,
30 }
31
32 impl Drop for and_then_get_big_again {
33     fn drop(&self) {}
34 }
35
36 fn and_then_get_big_again(x:int) -> and_then_get_big_again {
37     and_then_get_big_again {
38         x: x
39     }
40 }
41
42 fn main() {
43     do task::spawn {
44         getbig_and_fail(1);
45     };
46 }