diff options
| author | bors <bors@rust-lang.org> | 2023-06-01 05:32:00 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-06-01 05:32:00 +0000 |
| commit | 23f93a1266e0530445db590c15e0bb5c1c624eb6 (patch) | |
| tree | a6d69f418b10739c6d1d3216699a73f73febb363 /compiler/rustc_const_eval/src/errors.rs | |
| parent | ba1690bedd6ada4e8d91bfecb3d0ccc2b6de85ba (diff) | |
| parent | 05eae0823373415bb25063e3d0ccd99df52079b0 (diff) | |
| download | rust-23f93a1266e0530445db590c15e0bb5c1c624eb6.tar.gz rust-23f93a1266e0530445db590c15e0bb5c1c624eb6.zip | |
Auto merge of #103877 - oli-obk:const_eval_step_limit, r=fee1-dead
Replace const eval limit by a lint and add an exponential backoff warning The lint triggers at the first power of 2 that comes after 1 million function calls or traversed back-edges (takes less than a second on usual programs). After the first emission, an unsilenceable warning is repeated at every following power of 2 terminators, causing it to get reported less and less the longer the evaluation runs. cc `@rust-lang/wg-const-eval` fixes #93481 closes #67217
Diffstat (limited to 'compiler/rustc_const_eval/src/errors.rs')
| -rw-r--r-- | compiler/rustc_const_eval/src/errors.rs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/compiler/rustc_const_eval/src/errors.rs b/compiler/rustc_const_eval/src/errors.rs index f8b7cc6d7e1..ad2e68e752d 100644 --- a/compiler/rustc_const_eval/src/errors.rs +++ b/compiler/rustc_const_eval/src/errors.rs @@ -1,5 +1,5 @@ use rustc_hir::ConstContext; -use rustc_macros::Diagnostic; +use rustc_macros::{Diagnostic, LintDiagnostic}; use rustc_span::Span; #[derive(Diagnostic)] @@ -194,3 +194,21 @@ pub(crate) struct InteriorMutabilityBorrow { #[primary_span] pub span: Span, } + +#[derive(LintDiagnostic)] +#[diag(const_eval_long_running)] +#[note] +pub struct LongRunning { + #[help] + pub item_span: Span, +} + +#[derive(Diagnostic)] +#[diag(const_eval_long_running)] +pub struct LongRunningWarn { + #[primary_span] + #[label] + pub span: Span, + #[help] + pub item_span: Span, +} |
