Rollup merge of #79981 - camelid:overflowing_literals-inference-error, r=lcnr

Add 'consider using' message to overflowing_literals

Fixes #79744.

Ironically, the `overflowing_literals` handler for binary or hex already
had this message! You would think it would be the other way around :)

cc ```@scottmcm```
This commit is contained in:
Guillaume Gomez 2021-02-17 20:37:48 +01:00 committed by GitHub
commit ec007845cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 87 additions and 33 deletions

View file

@ -0,0 +1,13 @@
fn main() {
let elem = 6i8;
let e2 = 230;
//~^ ERROR literal out of range for `i8`
//~| HELP consider using the type `u8` instead
let mut vec = Vec::new();
vec.push(e2);
vec.push(elem);
println!("{:?}", vec);
}

View file

@ -0,0 +1,12 @@
error: literal out of range for `i8`
--> $DIR/issue-79744.rs:3:14
|
LL | let e2 = 230;
| ^^^
|
= note: `#[deny(overflowing_literals)]` on by default
= note: the literal `230` does not fit into the type `i8` whose range is `-128..=127`
= help: consider using the type `u8` instead
error: aborting due to previous error