]> git.lizzy.rs Git - rust.git/blob - src/test/ui/typeck/issue-98982.stderr
Auto merge of #96324 - berendjan:set_tcp_quickack, r=dtolnay
[rust.git] / src / test / ui / typeck / issue-98982.stderr
1 error[E0308]: mismatched types
2   --> $DIR/issue-98982.rs:2:5
3    |
4 LL |   fn foo() -> i32 {
5    |               --- expected `i32` because of return type
6 LL | /     for i in 0..0 {
7 LL | |
8 LL | |         return i;
9 LL | |     }
10    | |_____^ expected `i32`, found `()`
11    |
12 note: the function expects a value to always be returned, but loops might run zero times
13   --> $DIR/issue-98982.rs:2:5
14    |
15 LL |     for i in 0..0 {
16    |     ^^^^^^^^^^^^^ this might have zero elements to iterate on
17 LL |
18 LL |         return i;
19    |         -------- if the loop doesn't execute, this value would never get returned
20    = help: return a value for the case when the loop has zero elements to iterate on, or consider changing the return type to account for that possibility
21
22 error: aborting due to previous error
23
24 For more information about this error, try `rustc --explain E0308`.