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 2
2
3
3
fn f ( ) -> isize {
4
4
return g ( ) ;
5
- } //~ ERROR mismatched types [E0308]
5
+ //~^ ERROR mismatched types [E0308]
6
+ }
6
7
7
8
fn g ( ) -> usize {
8
9
return 0 ;
Original file line number Diff line number Diff line change 1
1
error[E0308]: mismatched types
2
- --> $DIR/tail-typeck .rs:1:26
2
+ --> $DIR/tail-return-type-mismatch .rs:4:12
3
3
|
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`
8
8
|
9
9
help: you can convert a `usize` to an `isize` and panic if the converted value doesn't fit
10
10
|
11
- LL | fn f() -> isize { return g().try_into().unwrap(); }
12
- | ++++++++++++++++++++
11
+ LL | return g().try_into().unwrap();
12
+ | ++++++++++++++++++++
13
13
14
14
error: aborting due to 1 previous error
15
15
You can’t perform that action at this time.
0 commit comments