We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents c575885 + 7b1916d commit 9ee4eadCopy full SHA for 9ee4ead
src/librustc_lint/builtin.rs
@@ -206,8 +206,8 @@ impl LintPass for TypeLimits {
206
let (min, max) = int_ty_range(int_type);
207
let negative = self.negated_expr_id == e.id;
208
209
- if (negative && v > min.wrapping_neg() as u64) ||
210
- (!negative && v > (max.abs() as u64)) {
+ if (negative && min != i64::MIN && v > -min as u64) ||
+ (!negative && v > max as u64) {
211
cx.span_lint(OVERFLOWING_LITERALS, e.span,
212
&*format!("literal out of range for {:?}", t));
213
return;
0 commit comments