summaryrefslogtreecommitdiffstats
path: root/tests/ui/loops/loop-no-implicit-break.rs
blob: 93078cb4b144beddda2329566c1383c223316689 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
fn main() {
    let a: i8 = loop {
        1 //~ ERROR mismatched types
    };

    let b: i8 = loop {
        break 1;
    };
}

fn foo() -> i8 {
    let a: i8 = loop {
        1 //~ ERROR mismatched types
    };

    let b: i8 = loop {
        break 1;
    };

    loop {
        1 //~ ERROR mismatched types
    }

    loop {
        return 1;
    }

    loop {
        1 //~ ERROR mismatched types
    }
}