rust/src/test/ui/borrowck/regions-escape-bound-fn-2.rs
2018-12-25 21:08:33 -07:00

11 lines
212 B
Rust

fn with_int<F>(f: F) where F: FnOnce(&isize) {
let x = 3;
f(&x);
}
fn main() {
let mut x = None;
with_int(|y| x = Some(y));
//~^ ERROR borrowed data cannot be stored outside of its closure
}