summaryrefslogtreecommitdiffstats
path: root/tests/ui/consts/const-eval/stable-metric/ctfe-labelled-loop.rs
blob: c10b8d83791193558d67f2a9bec809d9f3adecf2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// check-fail
// compile-flags: -Z tiny-const-eval-limit

const fn labelled_loop(n: u32) -> u32 {
    let mut i = 0;
    'mylabel: loop { //~ ERROR evaluation of constant value failed [E0080]
        if i > n {
            break 'mylabel
        }
        i += 1;
    }
    0
}

const X: u32 = labelled_loop(19);

fn main() {
    println!("{X}");
}