Open
Description
fn foo() -> u32 {
1
}
fn bar() {
let x: usize = foo();
}
we now present:
error[E0308]: mismatched types
--> src/lib.rs:6:20
|
6 | let x: usize = foo();
| ^^^^^ expected usize, found u32
help: you can convert an `u32` to `usize` and panic if the converted value wouldn't fit
|
6 | let x: usize = foo().try_into().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^
We should ideally also point at foo
and maybe tell the user to consider changing it.