From 64ca751eb000c498374435da666ddd1c878c03ad Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Sat, 31 Jan 2015 19:42:13 +0200 Subject: [PATCH] Mention the type in the overflowing literal lint Fixes #21807 --- src/librustc/lint/builtin.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index e8e8d35fe07..bdc0ea12e28 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -227,7 +227,7 @@ fn check_expr(&mut self, cx: &Context, e: &ast::Expr) { if (negative && v > (min.abs() as u64)) || (!negative && v > (max.abs() as u64)) { cx.span_lint(OVERFLOWING_LITERALS, e.span, - "literal out of range for its type"); + &*format!("literal out of range for {:?}", t)); return; } } @@ -246,7 +246,7 @@ fn check_expr(&mut self, cx: &Context, e: &ast::Expr) { }; if lit_val < min || lit_val > max { cx.span_lint(OVERFLOWING_LITERALS, e.span, - "literal out of range for its type"); + &*format!("literal out of range for {:?}", t)); } }, ty::ty_float(t) => { @@ -263,7 +263,7 @@ fn check_expr(&mut self, cx: &Context, e: &ast::Expr) { }; if lit_val < min || lit_val > max { cx.span_lint(OVERFLOWING_LITERALS, e.span, - "literal out of range for its type"); + &*format!("literal out of range for {:?}", t)); } }, _ => ()