Uh oh!
There was an error while loading. Please reload this page.
Fix inference for projections with associated traits with multiple bounds; fixes #34792 - #34912
Fix inference for projections with associated traits with multiple bounds; fixes #34792#34912rozbb wants to merge 1 commit into
Conversation
rust-highfive
commented
Jul 19, 2016
r? @pnkfelix (rust_highfive has picked a reviewer for you, use r? to override) |
rozbb
commented
Jul 19, 2016
r? @eddyb |
rozbb
commented
Jul 19, 2016
I recall someone saying that this might require a crater test. Is that still the case? |
eddyb
commented
Jul 19, 2016
@doomrobo Indeed, although you first need to fix the two |
There was a problem hiding this comment.
This doesn't need to be a probe, I believe in_snapshot will do.
Hmm. It appears that the error messages for Here is the gist for the first one. The second differs in the same way. I have no intuitions so far, but I'm looking into it. |
eddyb
commented
Jul 20, 2016
cc @nikomatsakis@jonathandturner What could cause those errors? It looks like the |
bors
commented
Aug 12, 2016
☔ The latest upstream changes (presumably #35091) made this pull request unmergeable. Please resolve the merge conflicts. |
alexcrichton
commented
Sep 9, 2016
Closing due to inactivity, but feel free to resubmit with a rebase! |
The problem was due to the fact that no particular trait bound was specified when a projection was matched with a trait bound, even when multiple bounds existed. The compiler consistently picked the first bound on the associated type that it found that was able to match the type's obligation (which, in the regression test, is
<F as Foo>or<Self as Foo>).The fix involved modifying the
SelectionCandidate::ProjectionCandidatevariant to carry a trait ref to refer to its matching bound. And instead of stopping on the first match we find, we add all matching bounds to thecandidatesvector. Also in the winnowing step, aProjectionCandidatecannot trump anotherProjectionCandidateunless they are identical.