No need to limit to single-threaded: as long as we reserve enough space in the TLS area it's possible to work with multiple threads.
Zig has future plans to require recursive functions to declare their maximum stack memory usage up-front, so that will provide the rest.
No need for recursion or multi-threading: If you call the function in a loop and don't release the escaped local unter after the loop, and if the number of loop iterations isn't statically known, then it's impossible to pre-allocate heap storage for that local variable.
Iād hazard a guess that the implementation will rely on use-after-free faulting, meaning that the use of any escaped variable will fault rather than corrupting the stack.