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