rust/src/test/compile-fail/borrowck-move-by-capture.rs

15 lines
273 B
Rust
Raw Normal View History

extern mod extra;
fn main() {
let foo = ~3;
let _pfoo = &foo;
let _f: @fn() -> int = || *foo + 5;
2013-03-15 14:24:24 -05:00
//~^ ERROR cannot move `foo`
let bar = ~3;
let _g = || {
let _h: @fn() -> int = || *bar;
//~^ ERROR illegal by-move capture
};
}