The NonZero type reminds me of something else I'd like to see in Rust; ranged integers. By which I mean integers that can only represent a specified range of numbers.
This is not so much for optimization but for type safety (i.e. avoiding bugs).
This is not so much for optimization but for type safety (i.e. avoiding bugs).
How viable would it be to implement an optimization step which seeks to minimize the number of these checks?