]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-eval/stable-metric/ctfe-labelled-loop.rs
Create stable metric to measure long computation in Const Eval
[rust.git] / src / test / ui / consts / const-eval / stable-metric / ctfe-labelled-loop.rs
1 // check-pass
2 #![feature(const_for)]
3
4 const fn labelled_loop() -> u32 {
5     let mut n = 0;
6     'outer: loop {
7         'inner: loop {
8             n = n + 1;
9             if n > 5 && n <= 10 {
10                 n = n + 1;
11                 continue 'inner
12             }
13             if n > 30 {
14                 break 'outer
15             }
16         }
17     }
18     n
19 }
20
21 const X: u32 = labelled_loop();
22
23 fn main() {
24     println!("{X}");
25 }