Skip to content

permit inference variables to be unified with unnormalized projections #305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

nikomatsakis
Copy link
Contributor

This fixes the rust-analyzer problems found in #280 and serves as an alternative to #294. I'm not really sure which approach I prefer -- there might even be a "third way" that is better still.

If nothing else, though, I think that the regression tests found on this branch is the correct form. I had to make a few small fixes to the test macro so that we could select the solver and specify the "max size" correctly.

nikomatsakis and others added 2 commits December 6, 2019 19:25
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.
I have a dim memory that this violates some invariant I wanted to
maintain, but I can't right now be sure that that is. I suppose it
means that answers can contain unnormalized projections, in theory,
which we might want to prevent.

The only time this is needed is when equating answers after
truncation. It's a rather special case and we might be able to do a
"smaller" fix.
@jackh726
Copy link
Member

jackh726 commented Dec 7, 2019

So, what's interesting about this approach is how it might overlap with the solution to the associated types double answer (#234). Like, the change to the other test output is interesting.

@nikomatsakis
Copy link
Contributor Author

Decided to close for now. Opened #306 to track my concerns with the current workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants