f9f354fc XL |
1 | fn with_int<F>(f: F) |
2 | where |
3 | F: FnOnce(&isize), |
4 | { |
223e47cc LB |
5 | let x = 3; |
6 | f(&x); |
7 | } |
8 | |
9 | fn main() { |
1a4d82fc |
10 | let mut x: Option<&isize> = None; |
2c00a5a8 |
11 | with_int(|y| x = Some(y)); |
f9f354fc |
12 | //~^ ERROR borrowed data escapes outside of closure |
223e47cc |
13 | } |