[rust-dev] Warn about implicit integer conversion
niko at alum.mit.edu
Thu Dec 20 05:59:44 PST 2012
Lindsey Kuper wrote:
> Our thinking at the time we implemented suffix inference was that if
> you went so far as to write the optional type annotation, then you
> should get the type you asked for, no questions asked, overflows and
> all. After all, sometimes people do want intentional overflow. But
> if it's causing nasty surprises, then, yeah, it should be revisited.
I think the best thing would be a simple lint check that visits each
literal and checks whether it can fit into the type assigned to it. It
will catch many simple cases like this one.
More information about the Rust-dev