rust/src/test/run-pass/resource-in-struct.rs
Brian Anderson 518dc52f85 Reformat
This changes the indexing syntax from .() to [], the vector syntax from ~[] to
[] and the extension syntax from #fmt() to #fmt[]
2011-08-20 11:04:00 -07:00

18 lines
333 B
Rust

// Ensures that putting resources inside structual types keeps
// working.
type closable = @mutable bool;
resource close_res(i: closable) { *i = false; }
tag option<T> { none; some(T); }
fn sink(res: option<close_res>) { }
fn main() {
let c = @mutable true;
sink(none);
sink(some(close_res(c)));
assert (!*c);
}