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

Add a ptr_eq to Shared to test if two Shareds share the same underlying future. #2673

Merged
merged 4 commits into from
Jan 1, 2023

Conversation

khuey
Copy link
Contributor

@khuey khuey commented Dec 13, 2022

Shared already has Arc's strong_count and weak_count. This will make it easier to implement PartialEq/Eq for structs containing a Shared.

@khuey khuey requested a review from taiki-e as a code owner December 13, 2022 02:55
@khuey
Copy link
Contributor Author

khuey commented Dec 13, 2022

Hrm, I want to be able to hash it too. Perhaps I should expose a pointer value (e.g. with a Shared::as_ptr that returns an opaque pointer value) rather than adding Shared::ptr_eq.

@khuey
Copy link
Contributor Author

khuey commented Dec 13, 2022

Or how about this?

Copy link
Member

@taiki-e taiki-e left a comment

Choose a reason for hiding this comment

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

Thanks!

@taiki-e taiki-e merged commit 0f83c20 into rust-lang:master Jan 1, 2023
@taiki-e taiki-e added A-future Area: futures::future 0.3-backport: pending The maintainer accepted to backport this to the 0.3 branch, but backport has not been done yet. labels Jan 1, 2023
@taiki-e taiki-e added 0.3-backport: completed and removed 0.3-backport: pending The maintainer accepted to backport this to the 0.3 branch, but backport has not been done yet. labels Jan 30, 2023
taiki-e pushed a commit that referenced this pull request Jan 30, 2023
taiki-e pushed a commit that referenced this pull request Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants