Uh oh!
There was an error while loading. Please reload this page.
Fix type inference related to upvars in closures - #21353
Conversation
rust-highfive
commented
Jan 18, 2015
r? @Aatch (rust_highfive has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Do you mind say where they're checked? "Elsewhere" tends to be kind of frustrating when looking at these comments.
There was a problem hiding this comment.
They are checked in numerous places... @nikomatsakis, do you have better ideas how to word this?
nikomatsakis
commented
Jan 20, 2015
I'm not sure what to make of this patch. Some thoughts:
@sanxiyn have you traced out just where the error is cropping up that you are preventing? |
sanxiyn
commented
Jan 20, 2015
As far as I understand, 3 is correct. The error comes from checking IntVar: Sized before i32 fallback. |
nikomatsakis
commented
Jan 21, 2015
OK, so, I started digging into the problem. I think it is a bug in the caching algorithm. I am double-checking, but I think the problem is that when we ask to get the list of upvar types for a closure, in some cases we do not yet know the result. This is because we haven't run all the inference we are going to need to figure everything out. This yields an ambiguous result -- which is generally the correct thing to do, and should not (typically) be harmful. However, in this case, what happens is that the ambiguous result gets cached -- again, not (typically) harmful, because normally the cache key is careful to note what parts needed more inference, so when more inference has been done, that cache entry no longer matches. (Example: |
nikomatsakis
commented
Jan 21, 2015
That said, this patch may still be a good optimization. But I'd prefer to land the full fix first. I'll prepare a PR now. |
nikomatsakis
commented
Jan 21, 2015
taking liberty of re-assigning responsibility for this patch to me |
sanxiyn
commented
Jan 27, 2015
This is waiting on #21523. |
nikomatsakis
commented
Jan 28, 2015
So the crucial underlying problem should be fixed now. Now the question is whether this patch on its own makes sense as a kind of optimization. |
sanxiyn
commented
Feb 6, 2015
I have updated a comment as suggested. |
nikomatsakis
commented
Feb 10, 2015
perf: Pre-allocate some buffers in parsing
Fix#20558.