]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/regions-escape-bound-fn.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / 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 }