]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/regions-escape-bound-fn.rs
Merge commit 'd3a2366ee877075c59b38bd8ced55f224fc7ef51' into sync_cg_clif-2022-07-26
[rust.git] / src / test / ui / borrowck / regions-escape-bound-fn.rs
1 fn with_int<F>(f: F)
2 where
3     F: FnOnce(&isize),
4 {
5     let x = 3;
6     f(&x);
7 }
8
9 fn main() {
10     let mut x: Option<&isize> = None;
11     with_int(|y| x = Some(y));
12     //~^ ERROR borrowed data escapes outside of closure
13 }