Search code examples
rustffiabort

How do I abort a Rust process?


I'm wrapping a C library that does some mallocs that can fail. The rest of Rust aborts on OOM so I'd like to do the same. There is std::intrinsics::abort() and core::intrinsics::abort() (what's the difference?) but they are both unstable.

How can I abort() with stable Rust?


Solution

  • Since Rust 1.17.0, you can call std::process::abort().