3 ms·
How have they leaked into Rust? I thought Rust had no implicit conversions?
by forrestthewoods 6y ago
How have they leaked into Rust? I thought Rust had no implicit conversions?
- steveklabnik 6y agoThere are a small number of coercions, but we do not do them around numeric types, it’s true. Not sure what your parent is referring to.
- ncmncm 6y agoIt does, however, have integer overflow, in release mode. So if you do code a conversion, you can end up with a value different from the source.
- carlmr 6y agoBut that's because Rust designs for zero cost abstractions in release mode. Overflow checking is not zero cost, so it's only enabled in debug mode, which is the maximum safety possible here while keeping it zero cost at (release) runtime. Without dependent types or something similar I don't know if it would be possible to check bounds.
- ncmncm 6y agoYes, there are reasons for it.