1 error[E0308]: mismatched types
2 --> $DIR/issue-100285.rs:2:5
4 LL | fn foo(n: i32) -> i32 {
5 | --- expected `i32` because of return type
13 | |_____^ expected `i32`, found `()`
15 note: the function expects a value to always be returned, but loops might run zero times
16 --> $DIR/issue-100285.rs:2:5
19 | ^^^^^^^^^^^^^ this might have zero elements to iterate on
22 | -------- if the loop doesn't execute, this value would never get returned
23 LL | } else if n < 10 {
25 | -------- if the loop doesn't execute, this value would never get returned
26 LL | } else if n < 20 {
28 | -------- if the loop doesn't execute, this value would never get returned
29 = note: if the loop doesn't execute, 3 other values would never get returned
30 = 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
32 error: aborting due to previous error
34 For more information about this error, try `rustc --explain E0308`.