> No custom allocator can make the task gracefully report failure
> instead of panicing.
So, first of all, "custom allocators" means two things: * overloading the allocator that's used by liballoc, and
the crates that depend on it, like libstd
* other allocators entirely
The first is described here: https://doc.rust-lang.org/book/custom-allocators.htmlAnd the second is still in RFCs: https://github.com/rust-lang/rfcs/pull/1398 Both of these things are not yet stable. The second does, in fact, give you the ability to return an error code, by returning a Result. However, on top of that, I don't see how > mostly a consequence of eschewing exceptions.
and > No custom allocator can make the task gracefully report failure
> instead of panicing.
Work together. Or rather, why is panic-ing bad, but an exception good? |
Because the Rust people don't believe in making "catch" a first-class primitive in the language, and in fact, fully support a runtime option to turn all panics into aborts.
Even if abort-on-panic were to be killed as a legal mode of operation, and even if the stigma were to be removed from std::panic::recover, we'd still be left with a language with two error handling strategies and endless programmer confusion over which to use.
Rust's designers have done permanent damage to the language by not making exceptions the primary error reporting mechanism available to programmers, and it's not a mistake they can undo now.