You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let a :Arc<dynSomeTrait> = getA();let b :Arc<dynSomeTrait> = getB();// The following two approaches don't work as expectedlet eq1 = std::ptr::eq(a.as_ref(), b.as_ref());let eq2 = Arc::ptr_eq(&a,&b);
I expected to see this happen:
trait object comparison works as expected, with no false positives or false negatives.
Instead, this happened:
see StackOverflow explanation. Fat pointer comparison is a complex topic and I believe it's a papercut issue that the developper has to understand the internals of fat pointer layout to be able to check for equality
The text was updated successfully, but these errors were encountered:
pwnorbitals
changed the title
Unable to easily check for equality between trait objects within an Arc?
Unable to easily check for equality between trait objects within an ArcApr 16, 2021
I tried this code (reference StackOverflow question) :
I expected to see this happen:
trait object comparison works as expected, with no false positives or false negatives.
Instead, this happened:
see StackOverflow explanation. Fat pointer comparison is a complex topic and I believe it's a papercut issue that the developper has to understand the internals of fat pointer layout to be able to check for equality
The text was updated successfully, but these errors were encountered: