Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Method call reference: major rewrite #1725
base: master
Are you sure you want to change the base?
Method call reference: major rewrite #1725
Changes from 8 commits
b73a724
d86363f
c52cfca
875073f
ba02319
f545a85
8e682a6
8c16081
a8c7502
3d73f8f
4f2125b
fb49894
f1a7dd7
e17b9b6
687a52b
41098a6
9d00834
923094b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, here's a question. Above, we create a list of candidate types. We then look for candidate methods in the last step. But notably, we collect candidate methods from extension candidates without regard to the candidate types:
Then we get to here, in the picking process. But this text now says that we're only considering those candidate types that can be reached via the
Deref
chain.So as written, this would seem to imply that the
Receiver
chain extending beyond theDeref
chain isn't considered at all with regard to selecting or picking methods from in scope traits, but that doesn't seem right.What's the right answer here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a perspective I hadn't thought of before: the
Receiver
trait makes no difference to method resolution for extension methods. I think that's the logically correct conclusion.However, the
Receiver
trait is considered also inwfcheck.rs
which rejects examples like this if you remove theimpl Receiver
before we even get as far as resolving any methods.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wild. OK, now this is snapping into focus.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, that then gives us something to explain in the text. We say:
There must, I'm guessing, be some interaction with the well-formedness checking at this point. I.e., maybe it's that if exactly one candidate is identified that is well-formed (where the well-formedness checking considers the
Receiver
chain), then it is picked. Because we don't report ambiguity errors just because two in-scope traits have a method of the same name that could apply. I'm thinking of examples like this:Playground link