fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #68568 - pietroalbini:stable-next, r=pietroalbini5e1a799842b

1.41.0
1.6 KiB47 linesraw
1error[E0658]: `while` is not allowed in a `const`
2  --> $DIR/infinite_loop.rs:7:9
3   |
4LL | /         while n != 0 {
5LL | |
6LL | |             n = if n % 2 == 0 { n/2 } else { 3*n + 1 };
7LL | |
8LL | |
9LL | |         }
10   | |_________^
11   |
12   = note: for more information, see https://github.com/rust-lang/rust/issues/52000
13   = help: add `#![feature(const_loop)]` to the crate attributes to enable
14   = help: add `#![feature(const_if_match)]` to the crate attributes to enable
15
16error[E0658]: `if` is not allowed in a `const`
17  --> $DIR/infinite_loop.rs:9:17
18   |
19LL |             n = if n % 2 == 0 { n/2 } else { 3*n + 1 };
20   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
21   |
22   = note: for more information, see https://github.com/rust-lang/rust/issues/49146
23   = help: add `#![feature(const_if_match)]` to the crate attributes to enable
24
25warning: Constant evaluating a complex constant, this might take some time
26  --> $DIR/infinite_loop.rs:4:18
27   |
28LL |       let _ = [(); {
29   |  __________________^
30LL | |
31LL | |         let mut n = 113383; // #20 in https://oeis.org/A006884
32LL | |         while n != 0 {
33...  |
34LL | |         n
35LL | |     }];
36   | |_____^
37
38error[E0080]: evaluation of constant value failed
39  --> $DIR/infinite_loop.rs:9:20
40   |
41LL |             n = if n % 2 == 0 { n/2 } else { 3*n + 1 };
42   |                    ^^^^^^^^^^ duplicate interpreter state observed here, const evaluation will never terminate
43
44error: aborting due to 3 previous errors
45
46Some errors have detailed explanations: E0080, E0658.
47For more information about an error, try `rustc --explain E0080`.