Comment by yakubin
2 years ago
In this case more important than any runtime overflow/underflow checks is the fact that the compiler will check that comparison operands are of the same type instead of inserting an implicit cast. Instead the programmer is forced to insert an explicit conversion like .try_into().unwrap(), which clearly suggests the possibility of an error. And if the error isn't handled, it will panic.
https://play.rust-lang.org/?version=stable&mode=debug&editio...
A similar warning could be enabled in GCC using the flag -Wsign-compare.