rust/src/test/run-pass/unique-pinned-nocopy-2.rs
Brian Anderson a96b16e8c3 Make it again possible to initialize resource locals via assignment
Some special cases allow both 'let a <- my_resource(x)' and
'let a = my_resource(x)' to work as expected despite ostensibly being
copies and moves.
2011-09-27 23:20:27 -07:00

11 lines
142 B
Rust

resource r(i: @mutable int) {
*i = *i + 1;
}
fn main() {
let i = @mutable 0;
{
let j = ~r(i);
}
assert *i == 1;
}