]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/regions-escape-bound-fn.rs
Rollup merge of #106707 - ehuss:remove-dupe-sha-1, r=Mark-Simulacrum
[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 }