-
Notifications
You must be signed in to change notification settings - Fork 48
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
Autoref/autoderef for operators #63
Conversation
Looks good to me! |
6793963
to
e8059c8
Compare
@nikomatsakis Did you intend to mere this or were you waiting on something? |
Would a conversation about autoderef behavior in patterns be part of this? |
I personally see that as pretty orthogonal. |
- are never quite sufficient (always more references are possible) | ||
- can cause inference regressions, as the compiler cannot in general know that | ||
`&T + &T` is equivalent to `u64 + u64`. | ||
|
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.
I think this note accurately captures the primary benefits of this: the compiler could avoid inference failures by considering the reference and non-reference possibilities without them being completely separate impls.
It might be worth mentioning something here about other tradeoffs. And in particular, we should consider whether there are circumstances where we might not want this behavior for a type, and whether people should be able to opt into or out of this behavior for a type.
2128ebc
to
accbd2b
Compare
Also extracting from rust-lang/rust#44619, in concert with #62.
r? @rust-lang/lang