3 ms·
This is what rust's `unreachable()!` is for... and I feel hubris whenever I use it.
by the__alchemist 10mo ago
This is what rust's `unreachable()!` is for... and I feel hubris whenever I use it.
- tialaramex 10mo agoYou should prefer to write unreachable!("because ...") to explain to some future maintenance engineer (maybe yourself) why you believed this would never be reached. Since they know it was reached they can compare what you believed against their observed facts and likely make better decisions. But at least telling people that the programmer believed this could never happen short-circuits their investigation considerably.