Objective-C have exceptions similar to C++ exceptions (not very familiar with these, maybe some of this applies here as well), and catching them require using the
objc_end_catch helper functions, similar to Rust calling the internal
__rust_panic_cleanup function as part of
objc-crate's exception handling, we currently resort to letting an Objective-C compiler (like
clang) generate a helper function that uses
@catch. This adds unnecessary overhead, and is bad for cross-compilation and all that.
core::intrinsics::try is the underlying intrinsic that makes
catch_unwind work; with it, the overhead can be avoided by effectively re-implementing most of
catch_unwind, see an example implementation here: Use nightly features by madsmtm · Pull Request #11 · SSheldon/rust-objc-exception · GitHub.
core::intrinsics::try is an intrinsic, and not intended to be stabilized, so I'd like to discuss a way we could stabilize it or parts of its functionality, to allow this use-case.