26 ms·
Conceptually, panics should be rare, because one firing means that some sort of unexpected problem has occurred. However, the real world is not "conceptually."
by steveklabnik 7y ago
Conceptually, panics should be rare, because one firing means that some sort of unexpected problem has occurred.
However, the real world is not "conceptually." I don't think there's any real data about how often they happen, but at least my experience is that tools I write in Rust rarely end up showing me panic output.
> That's not the case in C++ where "throw" is a keyword you are expected to use for error handling.
Yes, that's correct. The intended semantics of the two features are very, very different.
- matklad 7y agoA fun example here is rust-analyzer: we implement cancellation via unwinding. This is not technically a panic, but the mechanism is the same, and it more or less is invoked every time a user types something in a file.
- fluffything 7y agoWhere and why does rust-analyzer unwind from destructors ?