How would making it a hard error improve the situation? You are already getting a warning.
Isnât it a bug in the code? If you have a wrong syntax in a program you donât give a âsyntax warningâ. If a programmer wants a wrapping-around literal there should be a method/syntax for this uncommon special case. But the general case should be aligned with the rest of the language that handles overflows as bugs.
Also, I see the fact that âasâ could lose some information on default as a small design mistake that eventually weâll have to work around encouraging the use of other kinds of conversions (like try_from) and discouraging âasâ as much as possible (it should be regarded almost like unsafe{}, to be used only when you know what youâre doing and not as a first tool for common use by Rust newbies too).
I donât see the advantage of making this breaking change.
I see it as a compiler bug fix, that are allowed to break broken code, to improve the overall situation.
Automatically inferring a bigger type depending on a value seems like too much magic imo.
Itâs a tiny bit of magic, but I see it not too much different from inferring a number to be f64 because it ends with â.0â. And I agree this is a breaking change that could be unacceptableâŠ
We could add a compiler suggestion to add a suffix with a fitting type.
A compiler error plus compiler suggestion sounds OK 