-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Normalization issue with operators or Deref
#9971
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
Comments
This might be related to use std::ops::Add;
struct S;
impl Add<&Self> for S {
type Output = S;
fn add(self, _rhs: &Self) -> Self::Output {
todo!()
}
}
fn main() {
let s = S + &S;
} |
Deref
Actually, Edit: So this might actually be the same as #9968. |
Yeah, I think the problem is that we don't do coercions on the right hand side in binary ops (and assignment is a binary op, so that's #9968). |
Well, this is awkward... |
Should we also coerce on the LHS? |
There's nothing to really coerce to at that point. (rustc does coerce to a fresh type variable, but just to avoid too strict lifetime constraints.) |
|
9988: fix: Refactor & improve handling of overloaded binary operators r=flodiebold a=flodiebold Fixes #9971. Also records them as method resolutions, which we could use later. Co-authored-by: Florian Diebold <[email protected]>
CC #8961
The text was updated successfully, but these errors were encountered: