summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/regions-escape-bound-fn.rs
blob: f896ae7bdada25cf22c3b6b8cc387b5b135c5188 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
fn with_int<F>(f: F)
where
    F: FnOnce(&isize),
{
    let x = 3;
    f(&x);
}

fn main() {
    let mut x: Option<&isize> = None;
    with_int(|y| x = Some(y));
    //~^ ERROR borrowed data escapes outside of closure
}