Description
Currently, the const evaluator will continue forever if the program it is executing never terminates. There's a mechanism for detecting trivial infinite loops during const-eval, but this can't catch every non-terminating program.
We should have a configurable instruction limit for CTFE that's set to a relatively low initial value. Furthermore, disabling the instruction limit should also disable the infinite loop detector, since the user has indicated that they expect their program to execute for a long time.
The existing #![recursion_limit]
and #![type_length_limit]
attributes are somewhat related, but it would be ideal if the instruction limit could be applied per-item as well.
cc @rust-lang/wg-const-eval
As of 2022-01-31, the default const_eval_limit
is 1_000_000: