rust/tests/ui/consts/const-eval/stable-metric/ctfe-simple-loop.rs
2023-01-24 00:01:40 +00:00

16 lines
304 B
Rust

// check-fail
// compile-flags: -Z tiny-const-eval-limit
const fn simple_loop(n: u32) -> u32 {
let mut index = 0;
while index < n { //~ ERROR evaluation of constant value failed [E0080]
index = index + 1;
}
0
}
const X: u32 = simple_loop(19);
fn main() {
println!("{X}");
}