Open
Description
Hi,
Should lossy conversions (i.e. let a = 300u16 as u8
) be a compile time warning?
that way people can opt in with #![deny(cast_lossy)]
Otherwise maybe a way to make generic that have size constraints?
I'm working on a new library where I'm casting a bunch of stuff to usize
and for example usize::from(0u32)
isn't a thing. even though it should work on both 32bit and 64bit machines.
So right now I have a bunch of static asserts to check that size_of<usize> => size_of<u32>()
.
Edit: Related to #2715