Skip to content
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

remove function pointer comparisons #537

Merged
merged 1 commit into from
Mar 5, 2025
Merged

Conversation

dwrensha
Copy link
Member

@dwrensha dwrensha commented Jan 6, 2025

No description provided.

@dwrensha dwrensha added the breaking change requires version bump label Jan 6, 2025
@dwrensha dwrensha force-pushed the function-pointer-cmp branch from d05be06 to 68d3f7a Compare March 5, 2025 22:50
@dwrensha dwrensha removed the breaking change requires version bump label Mar 5, 2025
@dwrensha dwrensha marked this pull request as ready for review March 5, 2025 22:50
The impl of PartialEq for RawBrandedStructSchema depended on
comparing function pointers. The latest rustc emits a warning
indicating that such comparison is not reliable. So this
diff updates RawBrandedStructSchema to use a slower but more
reliable method to check for equality.

This diff also makes some assertions less strict in DynamicStruct and
DynamicList, because the previous strictness is now more expensive.
@dwrensha dwrensha force-pushed the function-pointer-cmp branch from 68d3f7a to 2361905 Compare March 5, 2025 22:53
@dwrensha dwrensha merged commit 128102c into master Mar 5, 2025
8 checks passed
@dwrensha dwrensha deleted the function-pointer-cmp branch March 5, 2025 23:09
// > since their addresses are not guaranteed to be unique

if core::ptr::eq(self.generic, other.generic) {
return false;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this return true?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! It should be negated, like this:

        if !core::ptr::eq(self.generic, other.generic) {
            return false;
        }

See #550.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants