rust/src/test/compile-fail/cap-clause-use-after-move.rs

6 lines
166 B
Rust

fn main() {
let x = 5;
let _y = fn~(move x) { }; //~ WARNING captured variable `x` not used in closure
let _z = x; //~ ERROR use of moved variable: `x`
}