]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/issue-45983.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / issue-45983.rs
1 // As documented in Issue #45983, this test is evaluating the quality
2 // of our diagnostics on erroneous code using higher-ranked closures.
3
4 fn give_any<F: for<'r> FnOnce(&'r ())>(f: F) {
5     f(&());
6 }
7
8 fn main() {
9     let mut x = None;
10     give_any(|y| x = Some(y));
11     //~^ ERROR borrowed data escapes outside of closure
12 }