-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Don't normalize xform_ret_ty during method candidate assembly #86506
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
So, I haven't looked into this issue or this exact fix, but I'm not sure if we should be moving to "normalize less" instead of "normalize more" |
Hm well maybe you should at least look at the PR :) As I wrote above we do normalize the return type, just not during candidate assembly. |
I mean, I've looked at the PR, but don't know exactly why this particular change fixes things. Does this issue get fixed by #85499 as-is. |
If that is a question, I don't know. You have a build, can you test whether this issue is fixed by that PR? |
r? @jackh726 |
☔ The latest upstream changes (presumably #89405) made this pull request unmergeable. Please resolve the merge conflicts. |
Okay, so finally getting a chance to look at this. Sorry this has sat so long @b-naber Now that I'm looking at this, I actually understand the problem here. It's a bit weird. Because of the That also causes our Delaying normalization of the return type does work, but I think that it hides a deeper bug. Ideally, I think the problem is the param_env itself. The clauses here probably shouldn't have For this, I suppose I'm okay with merging as-is. But with a more explicit comment that this problem stems from the r=me with that |
4e8bb79
to
fcf55a0
Compare
This comment has been minimized.
This comment has been minimized.
@jackh726 Thanks for the review. Opened the issue and added a FIXME comment. Kind of stumped by the CI fail though. |
You checked in submodule changes. That's probably it. |
fcf55a0
to
2d7ed7a
Compare
Thanks, hope this is fixed now. |
✌️ @b-naber can now approve this pull request |
2d7ed7a
to
3215403
Compare
@bors r=jackh726 rollup |
📌 Commit 3215403 has been approved by |
…, r=jackh726 Don't normalize xform_ret_ty during method candidate assembly Fixes rust-lang#85671 Normalizing the return type of a method candidate together with the expected receiver type of the method can lead to valid method candidates being rejected during probing. Specifically in the example of the fixed issue we have a `self_ty` of the form `&A<&[Coef]>` whereas the `impl_ty` of the method would be `&A<_>`, if we normalize the projection in the return type we unify the inference variable with `Cont`, which will lead us to reject the candidate in the sup type check in `consider_probe`. Since we don't actually need the normalized return type during candidate assembly, we postpone the normalization until we consider candidates in `consider_probe`.
…laumeGomez Rollup of 6 pull requests Successful merges: - rust-lang#86506 (Don't normalize xform_ret_ty during method candidate assembly ) - rust-lang#89538 (Make rustdoc not highlight `->` and `=>` as operators) - rust-lang#89649 (clippy::complexity fixes) - rust-lang#89668 (Cfg hide more conditions for core and alloc) - rust-lang#89669 (Remove special-casing of never primitive in rustdoc-json-types) - rust-lang#89672 (Remove unwrap_or! macro) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes #85671
Normalizing the return type of a method candidate together with the expected receiver type of the method can lead to valid method candidates being rejected during probing. Specifically in the example of the fixed issue we have a
self_ty
of the form&A<&[Coef]>
whereas theimpl_ty
of the method would be&A<_>
, if we normalize the projection in the return type we unify the inference variable withCont
, which will lead us to reject the candidate in the sup type check inconsider_probe
. Since we don't actually need the normalized return type during candidate assembly, we postpone the normalization until we consider candidates inconsider_probe
.