blob: 864dff40f46bb5fdb4dea5c44b07cc3d1bf5a90a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
  | 
// check that borrowck looks inside consts/statics
static FN : &'static (dyn Fn() -> Box<dyn Fn()->Box<i32>> + Sync) = &|| {
    let x = Box::new(0);
    Box::new(|| x) //~ ERROR cannot move out of `x`, a captured variable in an `Fn` closure
};
fn main() {
    let f = (FN)();
    f();
    f();
}
 
  |