Right, if your use case works with thread::scope (as I mentioned) you can get it working.
The thread::scope is kind of a workaround that may or may not work for your use case and I trust people are able to figure out that I’m illustrating a limitation, and not asking “how can I get this code to work”.
If lifetimes could be bounded from above, then we could say that references which the closure borrows are bounded above by the scope containing the thread. We can’t do this, so we use thread::scope instead, which introduces a second closure just to work around the limitation.
The thread::scope is kind of a workaround that may or may not work for your use case and I trust people are able to figure out that I’m illustrating a limitation, and not asking “how can I get this code to work”.
If lifetimes could be bounded from above, then we could say that references which the closure borrows are bounded above by the scope containing the thread. We can’t do this, so we use thread::scope instead, which introduces a second closure just to work around the limitation.