Skip to content

Commit 9613f48

Browse files
committed
add comment
1 parent 5a219cb commit 9613f48

File tree

1 file changed

+4
-0
lines changed
  • compiler/rustc_next_trait_solver/src/solve/eval_ctxt

1 file changed

+4
-0
lines changed

compiler/rustc_next_trait_solver/src/solve/eval_ctxt/canonical.rs

+4
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ where
157157
},
158158
);
159159

160+
// HACK: We bail with overflow if the response would have too many non-region
161+
// inference variables. This tends to only happen if we encounter a lot of
162+
// ambiguous alias types which get replaced with fresh inference variables
163+
// during generalization. This prevents a hang in nalgebra.
160164
let num_non_region_vars = canonical.variables.iter().filter(|c| !c.is_region()).count();
161165
if num_non_region_vars > self.cx().recursion_limit() {
162166
return Ok(self.make_ambiguous_response_no_constraints(MaybeCause::Overflow {

0 commit comments

Comments
 (0)