Skip to content

Commit

Permalink
bail if there are too many non-region infer vars
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed Sep 20, 2024
1 parent 2b11f26 commit 5a219cb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,13 @@ where
},
);

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)
}

Expand Down
2 changes: 2 additions & 0 deletions tests/ui/traits/coherence-alias-hang.rs
Original file line number Diff line number Diff line change
@@ -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>.

Expand Down

0 comments on commit 5a219cb

Please sign in to comment.