rust/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.rs

17 lines
326 B
Rust
Raw Normal View History

2017-12-03 17:00:46 -06:00
// revisions: ast mir
//[mir]compile-flags: -Z borrowck=mir
2015-01-07 20:53:58 -06:00
#![feature(box_syntax)]
fn call_f<F:FnOnce() -> isize>(f: F) -> isize {
f()
}
fn main() {
let t: Box<_> = box 3;
call_f(move|| { *t + 1 });
2017-12-03 17:00:46 -06:00
call_f(move|| { *t + 1 }); //[ast]~ ERROR capture of moved value
//[mir]~^ ERROR use of moved value
}