Open
Description
I just found several issues where people forget that -i32::MAX != i32::MIN
, i32::MAX == 7fffffff
while i32::MIN == -0x80000000
. People see that -0x80000000
works and then mistakenly try to use +0x80000000
which doesn't work because i32
can't represent it. What we should actually do is detect when people try to type out 0x80000000i32
or 0x80i8
, etc, and have a lint that warns about this problem. I'm thinking the lint should suggest casting to the unsigned type and back, because the user is probably trying to do bit manipulation which has subtleties with signed integers.