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)]
|
|
|
|
|
2015-01-08 04:54:35 -06:00
|
|
|
fn call_f<F:FnOnce() -> isize>(f: F) -> isize {
|
2013-07-17 06:19:43 -05:00
|
|
|
f()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2015-02-17 14:41:32 -06:00
|
|
|
let t: Box<_> = box 3;
|
2013-07-17 06:19:43 -05:00
|
|
|
|
2014-11-26 07:12:18 -06:00
|
|
|
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
|
2013-07-17 06:19:43 -05:00
|
|
|
}
|