2011-07-29 04:44:29 -05:00
|
|
|
// Ensures that putting resources inside structual types keeps
|
|
|
|
// working.
|
|
|
|
|
|
|
|
type closable = @mutable bool;
|
|
|
|
|
|
|
|
resource close_res(i: closable) {
|
|
|
|
*i = false;
|
|
|
|
}
|
|
|
|
|
2011-08-12 08:37:25 -05:00
|
|
|
tag option<T> { none; some(T); }
|
2011-07-29 04:44:29 -05:00
|
|
|
|
2011-08-10 11:27:22 -05:00
|
|
|
fn sink(res: option<close_res>) {}
|
2011-07-29 04:44:29 -05:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let c = @mutable true;
|
|
|
|
sink(none);
|
|
|
|
sink(some(close_res(c)));
|
|
|
|
assert !*c;
|
|
|
|
}
|