Skip to content

fix: do not compare references to pointers to compare pointers #3236

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

Merged
merged 1 commit into from
May 30, 2025

Conversation

samueltardieu
Copy link
Contributor

self and other are references, and the ptr::eq() call intends to determine if they designate the same object. Putting them behind another level of reference will always return false, as those short-lived references will be compared instead.

Solution

Remove the extra references.

As this is only an optimization which was missed, it is not possible to design a test which failed before this PR and succeeds after.

@samueltardieu
Copy link
Contributor Author

@carllerche @hawkw Hi there, any chance to get a review?

Copy link
Contributor

@kaffarell kaffarell left a comment

Choose a reason for hiding this comment

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

LGTM

@samueltardieu
Copy link
Contributor Author

Rebased

`self` and `other` are references, and the `ptr::eq()` call intends to
determine if they designate the same object. Putting them behind another
level of reference will always return `false`, as those short-lived
references will be compared instead.
@jplatte jplatte force-pushed the push-yvyxvmkmrvtw branch from db0bae3 to bcabba8 Compare May 30, 2025 09:24
@jplatte jplatte enabled auto-merge (squash) May 30, 2025 09:24
@jplatte jplatte merged commit ab355f6 into tokio-rs:master May 30, 2025
56 checks passed
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.

3 participants