about summary refs log tree commit diff
path: root/compiler/rustc_interface/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-01-29 04:11:27 +0000
committerbors <bors@rust-lang.org>2023-01-29 04:11:27 +0000
commit3cdd0197e78e2ca3403157617709bbfe18a3f0b5 (patch)
treef1408419d2d0288c966e40cbb9e455cb5da51603 /compiler/rustc_interface/src
parentbcb064a7f4aee705c97ce1b74beb9af0f9b5adb2 (diff)
parentbdb815a22ab00450dcc010a99309c24c475432a6 (diff)
downloadrust-3cdd0197e78e2ca3403157617709bbfe18a3f0b5.tar.gz
rust-3cdd0197e78e2ca3403157617709bbfe18a3f0b5.zip
Auto merge of #106227 - bryangarza:ctfe-limit, r=oli-obk
Use stable metric for const eval limit instead of current terminator-based logic

This patch adds a `MirPass` that inserts a new MIR instruction `ConstEvalCounter` to any loops and function calls in the CFG. This instruction is used during Const Eval to count against the `const_eval_limit`, and emit the `StepLimitReached` error, replacing the current logic which uses Terminators only.

The new method of counting loops and function calls should be more stable across compiler versions (i.e., not cause crates that compiled successfully before, to no longer compile when changes to the MIR generation/optimization are made).

Also see: #103877
Diffstat (limited to 'compiler/rustc_interface/src')
-rw-r--r--compiler/rustc_interface/src/tests.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs
index f94bc4d4c66..52a4e0e7418 100644
--- a/compiler/rustc_interface/src/tests.rs
+++ b/compiler/rustc_interface/src/tests.rs
@@ -802,6 +802,7 @@ fn test_unstable_options_tracking_hash() {
     tracked!(teach, true);
     tracked!(thinlto, Some(true));
     tracked!(thir_unsafeck, true);
+    tracked!(tiny_const_eval_limit, true);
     tracked!(tls_model, Some(TlsModel::GeneralDynamic));
     tracked!(trait_solver, TraitSolver::Chalk);
     tracked!(translate_remapped_path_to_local_path, false);