On Thu, Jun 12, 2025 at 11:20 AM Zhao Liu <zhao1....@intel.com> wrote: > > Right, I put it there because '2 lives until the second println!. The > > problem is not so much that it's returning token1, it's that the > > println uses it. > > Even after I comment out the last intln line, the compiler still > complains about returning token1. It seems the compiler's checking is > stricter.
Oh, you're right. Anything that the closure returns must have a longer lifetime than the closure itself! Paolo