Return early when treating ambiguous cycles#48
Return early when treating ambiguous cycles#48nikomatsakis merged 2 commits intorust-lang:masterfrom
Conversation
| _ => () | ||
| }; | ||
|
|
||
| answer = actual_answer; |
There was a problem hiding this comment.
is it possible to make a test for this? or is that test basically just in your PR for #12?
There was a problem hiding this comment.
Well that's funny because in fact if I provide a test for that and deactivate the fix, the test program will not even load because of the overlap check which will loop forever. So I was indeed relying on this behaviour to test the fix in my PR for #12 (the trait_wf test would not load without the fix). Still I added a general test in this PR, which is better for documentation.
| } else { | ||
| answer = actual_answer; | ||
| } | ||
| let fixed_point = actual_answer == answer; |
There was a problem hiding this comment.
Can you add a comment here explaining why we have this special case? Also, I suspect that you can get into similar problems when you have guidance as well, no?
There was a problem hiding this comment.
I suspect it as well although ambig with guidance can perform some unification, but I cannot find examples where a cycle gives ambig with guidance after being fed. Nonetheless stopping when we get Ambig regardless of the guidance should not affect correctness of the final answer.
This should solve the problem where an
Ambig(Unknown)answer was used to feed a cycle and not producing back any answer.