f6491bb426
This involved adding 'copy' to more generics than I hoped, but an experiment with making it implicit showed that that way lies madness -- unless enforced, you will not remember to mark functions that don't copy as not requiring copyable kind. Issue #1177
18 lines
333 B
Rust
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);
|
|
}
|