]> git.lizzy.rs Git - rust.git/commit
Fixes missing overflow lint for i64 #14269
authorFalco Hirschenberger <falco.hirschenberger@gmail.com>
Tue, 5 Aug 2014 07:59:03 +0000 (09:59 +0200)
committerFalco Hirschenberger <falco.hirschenberger@gmail.com>
Tue, 5 Aug 2014 07:59:03 +0000 (09:59 +0200)
commit0dc215741b34236c310e409c437600ba0165c97c
treebfaee6d4c3d1b082fadf859cb106b5e99d458028
parent795f6ae829ab1bfd72394a5da9096e2717ec0f62
Fixes missing overflow lint for i64 #14269

The `type_overflow` lint, doesn't catch the overflow for `i64` because
the overflow happens earlier in the parse phase when the `u64` as biggest
possible int gets casted to `i64` , without checking the for overflows.
We can't lint in the parse phase, so a refactoring of the `LitInt` type
was necessary.

The types `LitInt`, `LitUint` and `LitIntUnsuffixed` where merged to one
type `LitInt` which stores it's value as `u64`. An additional parameter was
added which indicate the signedness of the type and the sign of the value.
18 files changed:
src/libfourcc/lib.rs
src/librustc/lint/builtin.rs
src/librustc/middle/const_eval.rs
src/librustc/middle/trans/consts.rs
src/librustc/middle/typeck/check/mod.rs
src/librustdoc/clean/mod.rs
src/libsyntax/ast.rs
src/libsyntax/ext/build.rs
src/libsyntax/ext/bytes.rs
src/libsyntax/ext/concat.rs
src/libsyntax/ext/deriving/generic/mod.rs
src/libsyntax/ext/quote.rs
src/libsyntax/parse/mod.rs
src/libsyntax/parse/parser.rs
src/libsyntax/print/pprust.rs
src/test/compile-fail/lint-type-overflow.rs
src/test/compile-fail/oversized-literal.rs
src/test/run-pass/big-literals.rs