-
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
#[derive(PartialEq)] fails to compile with an Arc<Trait> field #39128
Comments
The derefs of the |
It looks related to #31740. |
Same thing for trait Trait {}
impl PartialEq for Box<Trait> {
fn eq(&self, _: &Box<Trait>) -> bool {
false
}
}
#[derive(PartialEq)]
struct S(Box<Trait>); The generated code looks like: impl PartialEq for S {
fn eq(&self, rhs: &S) -> bool {
match *rhs {
S(ref rhs) => match *self {
S(ref lhs) => true && (*lhs) == (*rhs)
}
}
}
}
|
This seems like a duplicate of #31740, as @stephaneyfx mentioned. Any reason to not close it as such? |
It should be possible to fix this issue without fixing the underlying one though, right? I'd appreciate it if this was fixed to work in Ideally it would also be nice to get an error message that this comes from |
Ugh, just ran into this today 😢 |
I'm also getting this. |
I just ran into this problem and solved it (for now) by using a newtype like this: Where before I had:
I now have:
|
Also ran into this. Though unlike the other examples, I was implementing |
I'm also struggling with this; I tried the solution from @TheNeikos, but Rust tells me that the |
I went with this to achieve simple pointer equality:
|
@garfieldnate @TheNeikos's solution is for a tuple struct with a single field. The I believe your situation is a different issue. |
Triage: Let's close as duplicate to duplicate of #31740. It seems much to fix the underlying issue rather than special casing a fix for just #[derive(PartialEq)]. |
Expanded:
The text was updated successfully, but these errors were encountered: