Can Rust support non-local return?

It wouldn't be terrible to represent this as a lifetime bound to the lexical control flow it affects, as if it borrowed a local in that scope. But I think we would also need some explicit function trait for this, so existing code that takes Fn / FnMut / FnOnce doesn't have to worry about non-local control flow.

Here's an older thread on TCP closures:

2 Likes