rust/src/test/run-pass/resource-in-struct.rs
Marijn Haverbeke 5adf87a2c6 Fix iter_structural_ty_full for resource types
The compiler would blow up when compiling a structural type
containing a resource.
2011-07-29 11:44:29 +02:00

20 lines
334 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;
}