]> git.lizzy.rs Git - rust.git/blob - src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2.rs
Permit `#[deprecated]` in stdlib
[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     let vec = vec![1, 2, 3];
10
11     loop {
12         {
13             let closure1 = || {
14                 match closure0.take() {
15                     Some(c) => {
16                         return c();
17                         //~^ ERROR type annotations needed
18                     }
19                     None => { }
20                 }
21             };
22             closure1();
23         }
24
25         closure0 = || vec;
26     }
27 }
28
29 fn main() { }