diff options
| author | petrochenkov <vadim.petrochenkov@gmail.com> | 2015-05-19 19:43:33 +0300 |
|---|---|---|
| committer | petrochenkov <vadim.petrochenkov@gmail.com> | 2015-05-20 13:03:18 +0300 |
| commit | 7b1916d25347913fce3e336517ef22025ccd875f (patch) | |
| tree | ff507429d6f650bbd328e01e6c5d0fb239c7eacf | |
| parent | 6d718f236dfdb086099d6147895416422aae4283 (diff) | |
| download | rust-7b1916d25347913fce3e336517ef22025ccd875f.tar.gz rust-7b1916d25347913fce3e336517ef22025ccd875f.zip | |
Fix panic in lint for out of range literals
| -rw-r--r-- | src/librustc_lint/builtin.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 3716ee395bf..bb449de2e8c 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -206,8 +206,8 @@ impl LintPass for TypeLimits { let (min, max) = int_ty_range(int_type); let negative = self.negated_expr_id == e.id; - if (negative && v > min.wrapping_neg() as u64) || - (!negative && v > (max.abs() as u64)) { + if (negative && min != i64::MIN && v > -min as u64) || + (!negative && v > max as u64) { cx.span_lint(OVERFLOWING_LITERALS, e.span, &*format!("literal out of range for {:?}", t)); return; |
