2018-08-08 07:28:26 -05:00
|
|
|
error[E0308]: mismatched types
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/wrong-ret-type.rs:2:49
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | fn mk_int() -> usize { let i: isize = 3; return i; }
|
2019-11-15 11:37:01 -06:00
|
|
|
| ----- ^ expected `usize`, found `isize`
|
2019-01-18 02:12:09 -06:00
|
|
|
| |
|
|
|
|
| expected `usize` because of return type
|
2019-12-03 19:32:50 -06:00
|
|
|
|
|
2020-09-29 21:27:58 -05:00
|
|
|
help: you can convert an `isize` to a `usize` and panic if the converted value doesn't fit
|
2019-12-03 19:32:50 -06:00
|
|
|
|
|
|
|
|
LL | fn mk_int() -> usize { let i: isize = 3; return i.try_into().unwrap(); }
|
2021-08-10 05:53:43 -05:00
|
|
|
| ++++++++++++++++++++
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
error: aborting due to previous error
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0308`.
|