summary refs log tree commit diff
path: root/src/test/run-pass/unwind-resource.rs
blob: a602a2716026ec7b1d652dbfd0a4106870c9d41b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// xfail-win32
extern mod std;

struct complainer {
  c: comm::Chan<bool>,
  drop { error!("About to send!");
    comm::send(self.c, true);
    error!("Sent!"); }
}

fn complainer(c: comm::Chan<bool>) -> complainer {
    error!("Hello!");
    complainer {
        c: c
    }
}

fn f(c: comm::Chan<bool>) {
    let _c <- complainer(c);
    fail;
}

fn main() {
    let p = comm::Port();
    let c = comm::Chan(&p);
    task::spawn_unlinked(|| f(c) );
    error!("hiiiiiiiii");
    assert comm::recv(p);
}