summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/issue-45983.rs
blob: 6784f6f86a010a31eb7590be12834b58624b9117 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
// As documented in Issue #45983, this test is evaluating the quality
// of our diagnostics on erroneous code using higher-ranked closures.

fn give_any<F: for<'r> FnOnce(&'r ())>(f: F) {
    f(&());
}

fn main() {
    let mut x = None;
    give_any(|y| x = Some(y));
    //~^ ERROR borrowed data escapes outside of closure
}