]>
Commit | Line | Data |
---|---|---|
b7449926 | 1 | error[E0308]: mismatched types |
0731742a | 2 | --> $DIR/wrong-ret-type.rs:2:49 |
b7449926 XL |
3 | | |
4 | LL | fn mk_int() -> usize { let i: isize = 3; return i; } | |
60c5eb7d | 5 | | ----- ^ expected `usize`, found `isize` |
9fa01778 XL |
6 | | | |
7 | | expected `usize` because of return type | |
60c5eb7d | 8 | | |
29967ef6 | 9 | help: you can convert an `isize` to a `usize` and panic if the converted value doesn't fit |
60c5eb7d XL |
10 | | |
11 | LL | fn mk_int() -> usize { let i: isize = 3; return i.try_into().unwrap(); } | |
c295e0f8 | 12 | | ++++++++++++++++++++ |
b7449926 XL |
13 | |
14 | error: aborting due to previous error | |
15 | ||
16 | For more information about this error, try `rustc --explain E0308`. |