summaryrefslogtreecommitdiffstats
path: root/tests/ui/consts/const-eval/stable-metric/ctfe-simple-loop.rs
blob: 214f33dfb36c5cf5711fa5651aaa030e9f280c98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// check-pass
// revisions: warn allow
#![cfg_attr(warn, warn(long_running_const_eval))]
#![cfg_attr(allow, allow(long_running_const_eval))]

// compile-flags: -Z tiny-const-eval-limit
const fn simple_loop(n: u32) -> u32 {
    let mut index = 0;
    while index < n {
        //~^ WARN is taking a long time
        //[warn]~| WARN is taking a long time
        //[warn]~| WARN is taking a long time
        index = index + 1;
    }
    0
}

const X: u32 = simple_loop(19);
const Y: u32 = simple_loop(35);

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