Closed
Description
This program should be legal
struct Foo {
v: ~[uint]
}
fn make_foo() -> Foo {
Foo { v: ~[1, 2, 3] }
}
fn main() {
let v = make_foo().v;
for v.each |i| { io::println(fmt!("%u", *i)); }
}
But it yields:
/Users/nmatsakis/tmp/bar.rs:10:12: 10:24 error: moving out of immutable field
/Users/nmatsakis/tmp/bar.rs:10 let v = make_foo().v;
^~~~~~~~~~~~