There isn’t a way to cast integer types into another which may fail. From::from only works if the conversion always succeeds. I suggest we add a coerce(A) -> B function which panics if the conversion fails. There should also be a try_coerce(A) -> Option<B> which simply returns None if the conversion fail. Currently these typically done using the as keyword which does no overflow checking and should rarely be used.
There should also be functions defined on the integers types which converts them to the opposite signness with the same size using a bitcast. This is also current done with as and will result in subtle error if the size of one of them changes.
Third, a bitcast function should be added which does the same thing as as. A lint should be added for as on integer types asking the user to use one of the newly introduced functions.