Mention the type in the overflowing literal lint

Fixes #21807
This commit is contained in:
Simonas Kazlauskas 2015-01-31 19:42:13 +02:00
parent 474b324eda
commit 64ca751eb0

View File

@ -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));
}
},
_ => ()