3 ms·
>> "Wrapping<u32> + 1" doesn't compile > Rust is pickier about numbers than many langauges; 1u32 + 1u8 doesn't compile either. Many people find this valuable;
by estebank 8y ago
>> "Wrapping<u32> + 1" doesn't compile
> Rust is pickier about numbers than many langauges; 1u32 + 1u8 doesn't compile either. Many people find this valuable; you don't have to memorize complex promotion rules, and you always get the semantic you asked for.
Although I'm happy with rust avoiding automatic promotion across the board, Wrapping<u32> + {integer}` could be handled more gracefully, in the same way that `u32 + {integer}` is handled.
- steveklabnik 8y agoYes; to be clear, what I'm saying here is "we tend to be conservative with these kinds of things at first". We could and may change this in the future, but once you do it, you can't go back. It's better to be conservative, feel where the pain leads you, and improve, then to speculate on things and end up adding bad stuff.