[Pre-RFC] Implicit number type widening

That might still be a correctness hazard. Right now, with struct Foo(i32); and x, y, z: u8, code like Foo(x * (y + z)) is a type error, which can prompt the programmer to explicitly convert x, y and z to i32 so that the calculation is performed over i32 and returns the expected result. With implicit widening of the 'top-level' x * (y + z) expression it will compile instead, perform the computation over u8 and potentially trigger incorrect wrapping or panicking.

17 Likes