by sapiogram · 3y ago · 0 comments
That's incorrect, a closure in Rust compiles down to a static function that takes its environment as an argument. None of that requires a heap allocation in the above code.
As a parting gift, I'll give you one guess what the title of the Wikipedia article on thread stacks is.