-
Notifications
You must be signed in to change notification settings - Fork 1.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 impl PartialEq/Eq for SharedReference and wrapper types #8815
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
8 Skipped Deployments
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
🟢 Turbopack Benchmark CI successful 🟢Thanks |
Logs
See job summary for details |
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) { | ||
self.inner.hash(state); | ||
self.inner.1.as_ptr().hash(state); |
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.
Maybe implement ptr_hash
on SharedReference
this.iter() | ||
.all(|(key, value)| other.get(key).map_or(false, |v| value.ptr_eq(v))) |
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.
Order should matter here. You can use zip()
instead. That's also more performant.
Description
Where feasible (I gave up on
TransientInstance<T>
) don't implPartialEq
,Eq
orHash
forSharedReference
or it's various wrapper types.These were previously using identity for equality, but I strongly prefer a more explicit approach (akin to
Arc::ptr_eq
) when using identity equality because it can lead to caching bugs where the caller didn't realize and expected value equality.Testing Instructions
This breaks the nextjs build and would require a companion nextjs PR if we wanted to go forward with this.