Test case for issue 2718

This was already fixed by the time I read the issue, but more test
cases are always good.

Closes #2718
This commit is contained in:
Tim Chevalier 2012-06-25 12:21:01 -07:00
parent e9f19283b3
commit 91b69aeb63

View file

@ -0,0 +1,38 @@
fn sender_terminate<T:send>(p: *packet<T>) {
}
class send_packet<T: send> {
let mut p: option<*packet<T>>;
new(p: *packet<T>) { self.p = some(p); }
drop {
if self.p != none {
let mut p = none;
p <-> self.p;
sender_terminate(option::unwrap(p))
}
}
fn unwrap() -> *packet<T> {
let mut p = none;
p <-> self.p;
option::unwrap(p)
}
}
enum state {
empty,
full,
blocked,
terminated
}
type packet<T: send> = {
mut state: state,
mut blocked_task: option<task::task>,
mut payload: option<T>
};
fn main() {
let _s: send_packet<int> = send_packet(ptr::addr_of({mut state: empty,
mut blocked_task: none,
mut payload: some(42)}));
}