Closed
Description
fn borrow(_x: &mut ~[()]) { }
fn consume(+_x: ~[()]) { }
fn main() {
let mut x = ~[()];
let xref = &mut x;
borrow(xref);
consume(x);
}
This code compiles, but gives an implicit copy warning on consume(x)
. Really the reason for this is because of the outstanding loan -- if { let xref ... borrow(xref); }
is enclosed in its own block, the warning goes away.
Perhaps the warning should give a bit more info about why the implicit copy is necessary?
(incidentally, if consume's argument is changed from copy-mode to move-mode, it doesn't compile at all, with the "outstanding loan" error.)