Open ignatenkobrain opened 6 years ago
The code only implements from_u64
and from_i64
. The rest will be upcast to larger types by the default FromPrimitive
methods. So a 32-bit from_usize(!16)
will call from_u64(0xffffffef)
, not sign-extended in any way, so it won't match the negative discriminant.
Either the test should reflect the difference between 32-bit and 64-bit usize
, or the implementation needs to change the way it compares values. I guess this is a design choice for the desired behavior.