News for hackers. Stuff that matters.
Re:Improving Rust compile times to enable adoption of memory... by insanitybit on Saturday February 04, 2023 @05:29PM (#34659099)
> I mean this is what you have to do to access variables from an async block:

I am clearly missing some context because that code is needlessly complex. Are you just trying to show that you have to clone values that you hold a reference to if you want to move them? Because yes, you do. But your example also needlessly borrows them in the outer closure.

Re:Improving Rust compile times to enable adoption of memory... by dcow on Monday February 06, 2023 @12:36AM (#34673763)
It’s not needless. I explained it a bit in my previous comment but it’s not worth diving into in this forum. To get an idea, consider scenarios along the lines of transforming a list of data in parallel using an async collection/iterator where all the futures are spawned and joined within the local scope of a single function. Hit me up in the Rust Discord if you want to chat about it and go into more details. Otherwise all I can really say is that I have encountered a few scenarios where this is necessary but shouldn’t be with improvements to the compiler.