An idea for TCP closures and rust's effect system

I'm in favor of MCP-49 and gen fn's extended to support specifying resume type, so the core is in fact generalized semi-coroutines while user still faces pretty syntax.
Also gen closures can be made to only specify types, not the bindings, in headers(|here|): we walkaround the first yield problem, but have to decide when the code before the first yield is executed...

My take on the topic is that Generator trait would only be used in case of mixing both yield and return, otherwise FnPinMut (not both at the same time).

Fair point. We solve this by requiring a mandatory round brackets around the type with only exception of () - the unit type.

Not to be rude, but this design is an entirely different topic - I intentionally stated that these are asumptions. If you want to discuss it - let's proceed to a different thread.

I would rather ask you:
What if we do non-local returns by stack unwinding? Given that we know:

  1. The precise location of an "exception" handler is known from label; (no search for handler)
  2. The transfer of return data is done by pointer write prior to unwinding process. (no data transfer and "exception objects")

If I understood correctly, only thing it has to do is to just unwind all stack frames prior to one where we returned and call their destructors.
Would that reduce unwinding overhead down to tolerable?

Also, what would happen if we do non-local return from a destructor?