Skip to content

Commit 4d233c7

Browse files
joshtriplettcuviper
authored andcommitted
Add entry about unlimited const evaluation
1 parent 2e8f90b commit 4d233c7

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

posts/2023-08-24-Rust-1.72.0.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,25 @@ If you'd like to help us out by testing future releases, you might consider upda
1919

2020
## What's in 1.72.0 stable
2121

22+
### Const evaluation time is now unlimited
23+
24+
To prevent user-provided const evaluation from getting into a compile-time
25+
infinite loop or otherwise taking unbounded time at compile time, Rust
26+
previously limited the maximum number of *statements* run as part of any given
27+
constant evaluation. However, especially creative Rust code could hit these
28+
limits and produce a compiler error. Worse, whether code hit the limit could
29+
vary wildly based on libraries invoked by the user; if a library you invoked
30+
split a statement into two within one of its functions, your code could then
31+
fail to compile.
32+
33+
Now, you can do an unlimited amount of const evaluation at compile time, To
34+
avoid having long compilations without feedback, the compiler will always emit
35+
a message after your compile-time code has been running for a while, and repeat
36+
that message after a period that doubles each time. By default, the compiler
37+
will also emit a deny-by-default lint (`const_eval_long_running`) after a large
38+
number of steps to catch infinite loops, but you can
39+
`allow(const_eval_long_running)` to permit especially long const evaluation.
40+
2241
### Uplifted lints from Clippy
2342

2443
Several lints from Clippy have been pulled into `rustc`:

0 commit comments

Comments
 (0)