2 ms·
> Panic is there to aleviate the really exceptional circumstances, when the trade-off for possible program termination is worth the much simplified error handli
by echelon 4y ago
> Panic is there to aleviate the really exceptional circumstances, when the trade-off for possible program termination is worth the much simplified error handling
It would be nice if Rust grew "panic annotations" so that we could determine shallowly and with automated tooling whether functions could panic. It would make it easy to isolate panicky behavior, and in places where it is absolutely necessary to handle, ensure that we do.
- TobTobXX 4y agoAlmost anything will panic when you're out of memory, as allocating is regarded as infallible (due to above mentioned tradeoff).
- marcus_cemes 4y agoThis kind of already exists in the form of #[no_panic] [1]? > If the function does panic (or the compiler fails to prove that the function cannot panic), the program fails to compile with a linker error that identifies the function name. 1: https://github.com/dtolnay/no-panic https://github.com/dtolnay/no-panic