5851d3242c
borrow checker and generalize what moves are allowed. Fixes a nasty bug or two in the pattern move checking code. Unifies dataflow code used for initialization and other things. First step towards once fns. Everybody wins. Fixes #4384. Fixes #4715. cc once fns (#2202), optimizing local moves (#5016).
14 lines
263 B
Rust
14 lines
263 B
Rust
extern mod extra;
|
|
|
|
fn main() {
|
|
let foo = ~3;
|
|
let _pfoo = &foo;
|
|
let _f: @fn() -> int = || *foo + 5;
|
|
//~^ ERROR cannot move `foo`
|
|
|
|
let bar = ~3;
|
|
let _g = || { //~ ERROR capture of moved value
|
|
let _h: @fn() -> int = || *bar;
|
|
};
|
|
}
|