]> git.lizzy.rs Git - rust.git/blob - src/test/ui/wrong-ret-type.stderr
Add 'src/tools/rust-analyzer/' from commit '977e12a0bdc3e329af179ef3a9d466af9eb613bb'
[rust.git] / src / test / ui / wrong-ret-type.stderr
1 error[E0308]: mismatched types
2   --> $DIR/wrong-ret-type.rs:2:49
3    |
4 LL | fn mk_int() -> usize { let i: isize = 3; return i; }
5    |                -----                            ^ expected `usize`, found `isize`
6    |                |
7    |                expected `usize` because of return type
8    |
9 help: you can convert an `isize` to a `usize` and panic if the converted value doesn't fit
10    |
11 LL | fn mk_int() -> usize { let i: isize = 3; return i.try_into().unwrap(); }
12    |                                                  ++++++++++++++++++++
13
14 error: aborting due to previous error
15
16 For more information about this error, try `rustc --explain E0308`.