Re:Never patterns, exhaustive matching, and uninhabited type...
by Rusky on Saturday August 18, 2018 @01:19PM
(#17789471)
I'm all for leaving asserts in release builds, but leaving in dead code based on uninhabited types isn't gonna help you catch RAM or CPU errors. You'll just continue into the error branch with an impossible value instead. It's the wrong layer for that.
[ Parent
| on HN ]
Re:Never patterns, exhaustive matching, and uninhabited type...
by saagarjha on Saturday August 18, 2018 @10:50PM
(#17792280)
This isn't an assert, it's not a runtime check; it's done at compile time. You need to prove to the compiler that your code can never reach this point; common ways of doing so are by calling exit or inserting an unconditional infinite loop. If your underlying computational platform is broken, this isn't going to save you, but I don't think there's much you can do at that point.