diff options
| author | lcnr <rust@lcnr.de> | 2024-09-20 14:49:03 +0000 |
|---|---|---|
| committer | lcnr <rust@lcnr.de> | 2024-09-20 14:49:03 +0000 |
| commit | 9613f487ae0e8c563caffad4ffdede3296002457 (patch) | |
| tree | e6d1a3790504af155b2998e0d53a27e5b59efd5c | |
| parent | 5a219cba9563dc869577f7b7a9e318a1565dd4da (diff) | |
add comment
| -rw-r--r-- | compiler/rustc_next_trait_solver/src/solve/eval_ctxt/canonical.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/canonical.rs b/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/canonical.rs index 3887f9c529c..4d743c05190 100644 --- a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/canonical.rs +++ b/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/canonical.rs @@ -157,6 +157,10 @@ where }, ); + // HACK: We bail with overflow if the response would have too many non-region + // inference variables. This tends to only happen if we encounter a lot of + // ambiguous alias types which get replaced with fresh inference variables + // during generalization. This prevents a hang in nalgebra. let num_non_region_vars = canonical.variables.iter().filter(|c| !c.is_region()).count(); if num_non_region_vars > self.cx().recursion_limit() { return Ok(self.make_ambiguous_response_no_constraints(MaybeCause::Overflow { |
