File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change 22
33fn f ( ) -> isize {
44 return g ( ) ;
5- } //~ ERROR mismatched types [E0308]
5+ //~^ ERROR mismatched types [E0308]
6+ }
67
78fn g ( ) -> usize {
89 return 0 ;
Original file line number Diff line number Diff line change 11error[E0308]: mismatched types
2- --> $DIR/tail-typeck .rs:1:26
2+ --> $DIR/tail-return-type-mismatch .rs:4:12
33 |
4- LL | fn f() -> isize { return g(); }
5- | ----- ^^^ expected `isize`, found `usize`
6- | |
7- | expected `isize` because of return type
4+ LL | fn f() -> isize {
5+ | ----- expected `isize` because of return type
6+ LL | return g();
7+ | ^^^ expected `isize`, found `usize`
88 |
99help: you can convert a `usize` to an `isize` and panic if the converted value doesn't fit
1010 |
11- LL | fn f() -> isize { return g().try_into().unwrap(); }
12- | ++++++++++++++++++++
11+ LL | return g().try_into().unwrap();
12+ | ++++++++++++++++++++
1313
1414error: aborting due to 1 previous error
1515
You can’t perform that action at this time.
0 commit comments