Hacker News new | ask | show | jobs
by dthul 1579 days ago
I was wondering whether the Rust compiler could treat Result enums specially and implement them as panics under the hood. But I guess such optimizations are not really feasible because they might change behavior when unwinding through FFI for example. Not even speaking of the possibility that each stack frame is able to convert the error type, unlike exceptions.
1 comments

It would also change the behavior of panicking destructors on the unwind path, since a second panic during an unwind causes an abort instead of another unwind