diff options
| author | bors <bors@rust-lang.org> | 2023-01-29 04:11:27 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-01-29 04:11:27 +0000 |
| commit | 3cdd0197e78e2ca3403157617709bbfe18a3f0b5 (patch) | |
| tree | f1408419d2d0288c966e40cbb9e455cb5da51603 /src | |
| parent | bcb064a7f4aee705c97ce1b74beb9af0f9b5adb2 (diff) | |
| parent | bdb815a22ab00450dcc010a99309c24c475432a6 (diff) | |
| download | rust-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 'src')
| -rw-r--r-- | src/doc/unstable-book/src/compiler-flags/tiny-const-eval-limit.md | 6 | ||||
| -rw-r--r-- | src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/doc/unstable-book/src/compiler-flags/tiny-const-eval-limit.md b/src/doc/unstable-book/src/compiler-flags/tiny-const-eval-limit.md new file mode 100644 index 00000000000..51c5fd69c63 --- /dev/null +++ b/src/doc/unstable-book/src/compiler-flags/tiny-const-eval-limit.md @@ -0,0 +1,6 @@ +# `tiny-const-eval-limit` + +-------------------- + +The `-Ztiny-const-eval-limit` compiler flag sets a tiny, non-configurable limit for const eval. +This flag should only be used by const eval tests in the rustc test suite. diff --git a/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs b/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs index 13de780b710..72705878075 100644 --- a/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs +++ b/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs @@ -240,6 +240,7 @@ fn check_statement<'tcx>( | StatementKind::Retag { .. } | StatementKind::AscribeUserType(..) | StatementKind::Coverage(..) + | StatementKind::ConstEvalCounter | StatementKind::Nop => Ok(()), } } |
