bail if there are too many non-region infer vars

This commit is contained in:
lcnr 2024-09-20 14:17:08 +00:00
parent 2b11f265b6
commit 5a219cba95
2 changed files with 9 additions and 0 deletions

View File

@ -157,6 +157,13 @@ pub(in crate::solve) fn evaluate_added_goals_and_make_canonical_response(
},
);
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 {
suggest_increasing_limit: true,
}));
}
Ok(canonical)
}

View File

@ -1,4 +1,6 @@
//@ check-pass
//@ revisions: current next
//[next]@ compile-flags: -Znext-solver
// Regression test for nalgebra hang <https://github.com/rust-lang/rust/issues/130056>.