]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/issue-45983.rs
Auto merge of #107843 - bjorn3:sync_cg_clif-2023-02-09, r=bjorn3
[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 }