]> git.lizzy.rs Git - rust.git/blob - tests/ui/typeck/issue-100285.rs
Rollup merge of #106712 - Ezrashaw:impl-ref-trait, r=estebank
[rust.git] / tests / ui / typeck / issue-100285.rs
1 fn foo(n: i32) -> i32 {
2     for i in 0..0 {
3     //~^ ERROR: mismatched types [E0308]
4        if n < 0 {
5         return i;
6         } else if n < 10 {
7           return 1;
8         } else if n < 20 {
9           return 2;
10         } else if n < 30 {
11           return 3;
12         } else if n < 40 {
13           return 4;
14         } else {
15           return 5;
16         }
17
18     }
19     //~| 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
20 }
21
22 fn main() {}