rust/src/test/compile-fail/borrowck-move-by-capture.rs
2013-04-30 06:59:32 -04:00

15 lines
271 B
Rust

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