mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 06:51:58 +00:00
13 lines
299 B
Rust
13 lines
299 B
Rust
// 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();
|
|
}
|