Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
When truncating a goal, don't truncate the environment #294
Not sure if this is the correct fix. It does solve the issue and, conceptually, I don't see a particular reason why we need to truncate the
I've tried to compile rust-analyzer with this PR, and it indeed fixes the issue
OK, so, the solution I had in mind was a bit different. We still permitted truncating the environment, but we also permitted unification of unnormalized projection types with inference variables.
This solution makes a lot of sense, but it also has some drawbacks. For example, if you have a Chalk goal like
then the clause
Let me open an alternative PR. We should definitely land something (also, rust-analyzer should probably increase the size of its max-types limit, 4 is absurdly low.)
This test dies with an overflow. With CHALK_DEBUG=1 this death is quick, without it, it is slow and painful. The problem is that some of the types in the environment are "truncated" and replaced with inference variables, but those types are unnormalized projections. When we then go to unify the environment found in the answer, we end up needing to unify inference variables with unnormalized projections -- but the current code creates subgoals instead, which leads to an infinite recursion.