diff options
| author | lcnr <rust@lcnr.de> | 2024-02-23 10:12:08 +0100 | 
|---|---|---|
| committer | lcnr <rust@lcnr.de> | 2024-02-29 10:14:02 +0100 | 
| commit | 5ec9b8d778b91cb579dc177eedaff4ba69bba33f (patch) | |
| tree | a01108aebbd3706569d548c9166b93be4874b727 /compiler/rustc_trait_selection/src/solve/mod.rs | |
| parent | d3d145ea1cae47ad392173f890577788117da3d9 (diff) | |
| download | rust-5ec9b8d778b91cb579dc177eedaff4ba69bba33f.tar.gz rust-5ec9b8d778b91cb579dc177eedaff4ba69bba33f.zip | |
distinguish recursion limit based overflow for diagnostics
also change the number of allowed fixpoint steps to be fixed instead of using the `log` of the total recursion depth.
Diffstat (limited to 'compiler/rustc_trait_selection/src/solve/mod.rs')
| -rw-r--r-- | compiler/rustc_trait_selection/src/solve/mod.rs | 11 | 
1 files changed, 11 insertions, 0 deletions
| diff --git a/compiler/rustc_trait_selection/src/solve/mod.rs b/compiler/rustc_trait_selection/src/solve/mod.rs index 51094b781c0..0bf28f520a4 100644 --- a/compiler/rustc_trait_selection/src/solve/mod.rs +++ b/compiler/rustc_trait_selection/src/solve/mod.rs @@ -42,6 +42,17 @@ pub use fulfill::FulfillmentCtxt; pub(crate) use normalize::deeply_normalize_for_diagnostics; pub use normalize::{deeply_normalize, deeply_normalize_with_skipped_universes}; +/// How many fixpoint iterations we should attempt inside of the solver before bailing +/// with overflow. +/// +/// We previously used `tcx.recursion_limit().0.checked_ilog2().unwrap_or(0)` for this. +/// However, it feels unlikely that uncreasing the recursion limit by a power of two +/// to get one more itereation is every useful or desirable. We now instead used a constant +/// here. If there ever ends up some use-cases where a bigger number of fixpoint iterations +/// is required, we can add a new attribute for that or revert this to be dependant on the +/// recursion limit again. However, this feels very unlikely. +const FIXPOINT_STEP_LIMIT: usize = 8; + #[derive(Debug, Clone, Copy)] enum SolverMode { /// Ordinary trait solving, using everywhere except for coherence. | 
