summary refs log tree commit diff
path: root/src/test/ui/consts/const-eval/infinite_loop.stderr
blob: e04c31cf397821d8463aa71ef786742f88e45e81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
error[E0658]: `while` is not allowed in a `const`
  --> $DIR/infinite_loop.rs:7:9
   |
LL | /         while n != 0 {
LL | |
LL | |             n = if n % 2 == 0 { n/2 } else { 3*n + 1 };
LL | |
LL | |
LL | |         }
   | |_________^
   |
   = note: see issue #52000 <https://github.com/rust-lang/rust/issues/52000> for more information
   = help: add `#![feature(const_loop)]` to the crate attributes to enable
   = help: add `#![feature(const_if_match)]` to the crate attributes to enable

error[E0658]: `if` is not allowed in a `const`
  --> $DIR/infinite_loop.rs:9:17
   |
LL |             n = if n % 2 == 0 { n/2 } else { 3*n + 1 };
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #49146 <https://github.com/rust-lang/rust/issues/49146> for more information
   = help: add `#![feature(const_if_match)]` to the crate attributes to enable

warning: Constant evaluating a complex constant, this might take some time
  --> $DIR/infinite_loop.rs:4:18
   |
LL |       let _ = [(); {
   |  __________________^
LL | |
LL | |         let mut n = 113383; // #20 in https://oeis.org/A006884
LL | |         while n != 0 {
...  |
LL | |         n
LL | |     }];
   | |_____^

error[E0080]: evaluation of constant value failed
  --> $DIR/infinite_loop.rs:9:20
   |
LL |             n = if n % 2 == 0 { n/2 } else { 3*n + 1 };
   |                    ^^^^^^^^^^ duplicate interpreter state observed here, const evaluation will never terminate

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0080, E0658.
For more information about an error, try `rustc --explain E0080`.