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

17 lines
281 B
Rust

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