]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/const-eval/infinite_loop.rs
Bless and update consts tests
[rust.git] / tests / ui / consts / const-eval / infinite_loop.rs
1 fn main() {
2     // Tests the Collatz conjecture with an incorrect base case (0 instead of 1).
3     // The value of `n` will loop indefinitely (4 - 2 - 1 - 4).
4     let _ = [(); {
5         let mut n = 113383; // #20 in https://oeis.org/A006884
6         while n != 0 {
7             //~^ ERROR evaluation of constant value failed
8             n = if n % 2 == 0 { n/2 } else { 3*n + 1 };
9         }
10         n
11     }];
12 }