]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #106227 - bryangarza:ctfe-limit, r=oli-obk
authorbors <bors@rust-lang.org>
Sun, 29 Jan 2023 04:11:27 +0000 (04:11 +0000)
committerbors <bors@rust-lang.org>
Sun, 29 Jan 2023 04:11:27 +0000 (04:11 +0000)
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

12 files changed:
1  2 
compiler/rustc_codegen_cranelift/src/base.rs
compiler/rustc_const_eval/src/transform/check_consts/check.rs
compiler/rustc_const_eval/src/transform/validate.rs
compiler/rustc_middle/src/mir/mod.rs
compiler/rustc_middle/src/mir/spanview.rs
compiler/rustc_middle/src/ty/context.rs
compiler/rustc_mir_transform/src/check_unsafety.rs
compiler/rustc_mir_transform/src/generator.rs
compiler/rustc_mir_transform/src/lib.rs
compiler/rustc_session/src/options.rs
src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs
tests/rustdoc-ui/z-help.stdout

Simple merge
Simple merge
Simple merge