]> git.lizzy.rs Git - rust.git/blob - src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2.rs
Rollup merge of #106043 - c410-f3r:moar-errors, r=petrochenkov
[rust.git] / src / test / ui / unboxed-closures / unboxed-closures-failed-recursive-fn-2.rs
1 // Various unsuccessful attempts to put the unboxed closure kind
2 // inference into an awkward position that might require fixed point
3 // iteration (basically where inferring the kind of a closure `c`
4 // would require knowing the kind of `c`). I currently believe this is
5 // impossible.
6
7 fn a() {
8     let mut closure0 = None;
9     //~^ ERROR type annotations needed
10     let vec = vec![1, 2, 3];
11
12     loop {
13         {
14             let closure1 = || {
15                 match closure0.take() {
16                     Some(c) => {
17                         return c();
18                     }
19                     None => { }
20                 }
21             };
22             closure1();
23         }
24
25         closure0 = || vec;
26     }
27 }
28
29 fn main() { }