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:
commit
ec007845cf
10 changed files with 87 additions and 33 deletions
13
src/test/ui/issues/issue-79744.rs
Normal file
13
src/test/ui/issues/issue-79744.rs
Normal 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);
|
||||
}
|
||||
12
src/test/ui/issues/issue-79744.stderr
Normal file
12
src/test/ui/issues/issue-79744.stderr
Normal 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
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue