2012-05-10 19:58:23 -07:00
|
|
|
fn borrow(v: &int, f: fn(x: &int)) {
|
|
|
|
f(v);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn box_imm() {
|
|
|
|
let mut v = ~3;
|
2012-06-30 12:23:59 +01:00
|
|
|
let _w = &mut v; //~ NOTE loan of mutable local variable granted here
|
2012-06-30 16:19:07 -07:00
|
|
|
do task::spawn |move v| {
|
2012-06-30 12:23:59 +01:00
|
|
|
//~^ ERROR moving out of mutable local variable prohibited due to outstanding loan
|
2012-05-10 19:58:23 -07:00
|
|
|
#debug["v=%d", *v];
|
|
|
|
}
|
|
|
|
|
|
|
|
let mut v = ~3;
|
2012-06-30 12:23:59 +01:00
|
|
|
let _w = &mut v; //~ NOTE loan of mutable local variable granted here
|
2012-05-10 19:58:23 -07:00
|
|
|
task::spawn(fn~(move v) {
|
2012-06-30 12:23:59 +01:00
|
|
|
//~^ ERROR moving out of mutable local variable prohibited due to outstanding loan
|
2012-05-10 19:58:23 -07:00
|
|
|
#debug["v=%d", *v];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
}
|