about summary refs log tree commit diff
path: root/tests/ui/explicit-tail-calls/recursion-etc.rs
blob: c22401d23799d8e9fcf513b850346351293cf435 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//@ run-pass
//@ ignore-backends: gcc
#![expect(incomplete_features)]
#![feature(explicit_tail_calls)]

use std::hint::black_box;

pub fn count(curr: u64, top: u64) -> u64 {
   if black_box(curr) >= top {
        curr
   } else {
        become count(curr + 1, top)
   }
}

fn main() {
    println!("{}", count(0, black_box(1000000)));
}