Rust also has the traceback/exception error handling mode in the panic cases. And since there's no standard way to check those at compile time you're left to fuzz the code to find all the possibilities (or use some hacks). It would be great if the compiler could be put into a mode where panics are handled like errors that need to be explicitly handled. Maybe something like:
1) At the function level or crate level being able to specify if the code can or can't panic, sort of like safe/unsafe function signatures.
2) Being able to have blocks of code return MaybePaniced<T> and have to turn that into an error or other result. If it's not handled and the function/crate is marked as nopanic the compiler rejects the code.
It would make the code more robust, and allow for an ecosystem where just like nostd you can specify that your crate is nopanic which helps in some environments.
I found a crate that claims to do #1: https://github.com/dtolnay/no-panic
This also looks interesting: https://github.com/Technolution/rustig
Yep, the no-panic crate is the hack I mentioned. It's using the linking process to fail compilation if I remember correctly. It only works on individual functions. rustig I didn't know and looks very interesting, thanks. Having it integrated in the compiler as annotations and guarantees would be ideal.
Here is one (recently created) that operates on the whole program rather than a single function: https://crates.io/crates/no-panics-whatsoever