diff options
| author | Falco Hirschenberger <falco.hirschenberger@gmail.com> | 2014-08-05 09:59:03 +0200 |
|---|---|---|
| committer | Falco Hirschenberger <falco.hirschenberger@gmail.com> | 2014-08-05 09:59:03 +0200 |
| commit | 0dc215741b34236c310e409c437600ba0165c97c (patch) | |
| tree | bfaee6d4c3d1b082fadf859cb106b5e99d458028 /src/libfourcc/lib.rs | |
| parent | 795f6ae829ab1bfd72394a5da9096e2717ec0f62 (diff) | |
| download | rust-0dc215741b34236c310e409c437600ba0165c97c.tar.gz rust-0dc215741b34236c310e409c437600ba0165c97c.zip | |
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.
Diffstat (limited to 'src/libfourcc/lib.rs')
| -rw-r--r-- | src/libfourcc/lib.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libfourcc/lib.rs b/src/libfourcc/lib.rs index 4596c98cffd..bac5b6e1013 100644 --- a/src/libfourcc/lib.rs +++ b/src/libfourcc/lib.rs @@ -124,7 +124,7 @@ pub fn expand_syntax_ext(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) (val << 8) | (byte as u32) }; } - let e = cx.expr_lit(sp, ast::LitUint(val as u64, ast::TyU32)); + let e = cx.expr_lit(sp, ast::LitInt(val as u64, ast::UnsignedIntLit(ast::TyU32))); MacExpr::new(e) } |
