2015-08-31 22:37:05 +03:00
|
|
|
// check that borrowck looks inside consts/statics
|
|
|
|
|
2019-05-28 14:46:13 -04:00
|
|
|
static FN : &'static (dyn Fn() -> (Box<dyn Fn()->Box<i32>>) + Sync) = &|| {
|
2017-12-10 23:29:24 +03:00
|
|
|
let x = Box::new(0);
|
2019-05-05 12:02:32 +01:00
|
|
|
Box::new(|| x) //~ ERROR cannot move out of `x`, a captured variable in an `Fn` closure
|
2015-08-31 22:37:05 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let f = (FN)();
|
|
|
|
f();
|
|
|
|
f();
|
|
|
|
}
|