3 ms·
I like to say "Rust has exceptions, you just can't catch them". If you use panic!() in Rust, it will unwind the stack, just like exceptions do. Destructors corr
by qznc 11y ago
I like to say "Rust has exceptions, you just can't catch them". If you use panic!() in Rust, it will unwind the stack, just like exceptions do. Destructors correspond to finally blocks in Java.
- sanderjd 11y agoAlso worth noting that "things come unglued" applies to panics in destructors in Rust the way it applies to exceptions in destructors in C++.