rust/src/test/ui/const-eval
bors d573fe1778 Auto merge of #51702 - ecstatic-morse:infinite-loop-detection, r=oli-obk
Infinite loop detection for const evaluation

Resolves #50637.

An `EvalContext` stores the transient state (stack, heap, etc.) of the MIRI virtual machine while it executing code. As long as MIRI only executes pure functions, we can detect if a program is in a state where it will never terminate by periodically taking a "snapshot" of this transient state and comparing it to previous ones. If any two states are exactly equal, the machine must be in an infinite loop.

Instead of fully cloning a snapshot every time the detector is run, we store a snapshot's hash. Only when a hash collision occurs do we fully clone the interpreter state. Future snapshots which cause a collision will be compared against this clone, causing the interpreter to abort if they are equal.

At the moment, snapshots are not taken until MIRI has progressed a certain amount. After this threshold, snapshots are taken every `DETECTOR_SNAPSHOT_PERIOD` steps. This means that an infinite loop with period `P` will be detected after a maximum of `2 * P * DETECTOR_SNAPSHOT_PERIOD` interpreter steps. The factor of 2 arises because we only clone a snapshot after it causes a hash collision.
2018-07-11 16:24:46 +00:00
..
conditional_array_execution.nll.stderr Turn the use of erroneous constants into errors again 2018-06-28 11:04:26 +02:00
conditional_array_execution.rs Don't const propagate the body of constants 2018-06-28 11:04:25 +02:00
conditional_array_execution.stderr Turn the use of erroneous constants into errors again 2018-06-28 11:04:26 +02:00
const_let.rs Report let bindings and statements as unstable 2018-05-22 10:54:05 +02:00
const_let.stderr Report let bindings and statements as unstable 2018-05-22 10:54:05 +02:00
const_signed_pat.rs migrate codebase to ..= inclusive range patterns 2018-06-26 07:53:30 -07:00
const_transmute.rs Rename must-compile-successfully into compile-pass 2018-04-13 23:28:03 +02:00
dont_promote_unstable_const_fn.nll.stderr Enforce stability of const fn in promoteds 2018-05-24 17:22:31 +02:00
dont_promote_unstable_const_fn.rs Enforce stability of const fn in promoteds 2018-05-24 17:22:31 +02:00
dont_promote_unstable_const_fn.stderr Enforce stability of const fn in promoteds 2018-05-24 17:22:31 +02:00
duration_conversion.rs const time 2018-05-10 22:10:11 +03:00
enum_discr.rs Allow variant discriminant initializers to refer to other initializers of the same enum 2018-04-26 08:54:14 +02:00
extern_fat_pointer.rs Fix thinning pointers to extern types in miri 2018-05-08 13:52:20 +02:00
ice-generic-assoc-const.rs Don't use ParamEnv::reveal_all() if there is a real one available 2018-06-27 18:24:24 +02:00
ice-packed.rs Allow unaligned reads in constants 2018-05-02 15:48:26 +02:00
index_out_of_bounds.rs Deduplicate error reports for statics 2018-07-03 12:03:47 +02:00
index_out_of_bounds.stderr Deduplicate error reports for statics 2018-07-03 12:03:47 +02:00
infinite_loop.rs Shorten error message and add link to test 2018-07-04 14:36:07 -07:00
infinite_loop.stderr Shorten error message and add link to test 2018-07-04 14:36:07 -07:00
issue-43197.nll.stderr Turn the use of erroneous constants into errors again 2018-06-28 11:04:26 +02:00
issue-43197.rs Don't const propagate the body of constants 2018-06-28 11:04:25 +02:00
issue-43197.stderr Turn the use of erroneous constants into errors again 2018-06-28 11:04:26 +02:00
issue-44578.nll.stderr Turn the use of erroneous constants into errors again 2018-06-28 11:04:26 +02:00
issue-44578.rs Properly report transitive errors 2018-06-05 20:49:47 +02:00
issue-44578.stderr Turn the use of erroneous constants into errors again 2018-06-28 11:04:26 +02:00
issue-47971.rs Rename must-compile-successfully into compile-pass 2018-04-13 23:28:03 +02:00
issue-50706.rs Go through an allocation when accessing fields of constants 2018-05-19 14:24:24 +02:00
issue-50814-2.rs Satisfy the untiring tidy 2018-06-05 20:49:47 +02:00
issue-50814-2.stderr Turn the use of erroneous constants into errors again 2018-06-28 11:04:26 +02:00
issue-50814.rs Satisfy the untiring tidy 2018-06-05 20:49:47 +02:00
issue-50814.stderr Turn the use of erroneous constants into errors again 2018-06-28 11:04:26 +02:00
issue-51300.rs Correctly access ScalarPair fields during const eval 2018-06-02 23:34:25 +02:00
no_lint_for_statically_known_error.rs Rename must-compile-successfully into compile-pass 2018-04-13 23:28:03 +02:00
promoted_const_fn_fail.rs Refactor the const eval diagnostic API 2018-06-05 20:49:46 +02:00
promoted_const_fn_fail.stderr Refactor the const eval diagnostic API 2018-06-05 20:49:46 +02:00
promoted_errors.rs Release mode overflows should not cause const eval to error 2018-05-19 13:10:51 +02:00
promoted_errors.stderr Refactor the const eval diagnostic API 2018-06-05 20:49:46 +02:00
pub_const_err.rs Don't const propagate the body of constants 2018-06-28 11:04:25 +02:00
pub_const_err.stderr Don't const propagate the body of constants 2018-06-28 11:04:25 +02:00
pub_const_err_bin.rs Don't const propagate the body of constants 2018-06-28 11:04:25 +02:00
pub_const_err_bin.stderr Don't const propagate the body of constants 2018-06-28 11:04:25 +02:00
ref_to_float_transmute.rs Add missing newlines 2018-05-24 20:49:38 +02:00
ref_to_int_match.rs migrate codebase to ..= inclusive range patterns 2018-06-26 07:53:30 -07:00
ref_to_int_match.stderr migrate codebase to ..= inclusive range patterns 2018-06-26 07:53:30 -07:00
shift_overflow.rs Detect overflows of non u32 shifts 2018-06-27 13:47:19 +02:00
shift_overflow.stderr Detect overflows of non u32 shifts 2018-06-27 13:47:19 +02:00
strlen.rs Add some runtime sanity checks 2018-05-21 19:00:56 +02:00
union_promotion.rs Do not promote union field accesses 2018-06-03 19:06:31 +02:00
union_promotion.stderr Do not promote union field accesses 2018-06-03 19:06:31 +02:00