2015-01-08 04:54:35 -06:00
|
|
|
fn with_int<F>(f: F) where F: FnOnce(&isize) {
|
2012-08-13 17:06:13 -05:00
|
|
|
let x = 3;
|
|
|
|
f(&x);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2012-08-20 14:23:37 -05:00
|
|
|
let mut x = None;
|
|
|
|
with_int(|y| x = Some(y));
|
2018-01-15 12:55:10 -06:00
|
|
|
//~^ ERROR borrowed data cannot be stored outside of its closure
|
2012-08-13 17:06:13 -05:00
|
|
|
}
|