2017-12-04 01:00:46 +02:00
|
|
|
// revisions: ast mir
|
|
|
|
//[mir]compile-flags: -Z borrowck=mir
|
|
|
|
|
2015-01-07 18:53:58 -08:00
|
|
|
#![feature(box_syntax)]
|
|
|
|
|
2015-01-08 21:54:35 +11:00
|
|
|
fn call_f<F:FnOnce() -> isize>(f: F) -> isize {
|
2013-07-17 07:19:43 -04:00
|
|
|
f()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2015-02-17 21:41:32 +01:00
|
|
|
let t: Box<_> = box 3;
|
2013-07-17 07:19:43 -04:00
|
|
|
|
2014-11-26 08:12:18 -05:00
|
|
|
call_f(move|| { *t + 1 });
|
2017-12-04 01:00:46 +02:00
|
|
|
call_f(move|| { *t + 1 }); //[ast]~ ERROR capture of moved value
|
|
|
|
//[mir]~^ ERROR use of moved value
|
2013-07-17 07:19:43 -04:00
|
|
|
}
|