From 7b1916d25347913fce3e336517ef22025ccd875f Mon Sep 17 00:00:00 2001 From: petrochenkov Date: Tue, 19 May 2015 19:43:33 +0300 Subject: [PATCH] Fix panic in lint for out of range literals --- src/librustc_lint/builtin.rs | 4 ++-- 1 file 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;