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

portable-atomic-util: Arc::{into_raw,as_ptr} should not take self #139

Closed
taiki-e opened this issue Dec 16, 2023 · 0 comments · Fixed by #142
Closed

portable-atomic-util: Arc::{into_raw,as_ptr} should not take self #139

taiki-e opened this issue Dec 16, 2023 · 0 comments · Fixed by #142
Labels
A-portable-atomic-util Area: related to portable-atomic-util crate C-bug Category: related to a bug.

Comments

@taiki-e
Copy link
Owner

taiki-e commented Dec 16, 2023

It should match with std' APIs.

https://doc.rust-lang.org/nightly/std/sync/struct.Arc.html#method.into_raw

pub fn into_raw(this: Self) -> *const T;
pub fn as_ptr(this: &Self) -> *const T;

https://docs.rs/portable-atomic-util/latest/portable_atomic_util/struct.Arc.html#method.into_raw

pub fn into_raw(self) -> *const T;
pub fn as_ptr(&self) -> *const T;

The current APIs cause Arc::as_ptr to be called in code that tries to call T::as_ptr, so the semantics will change when using std and when using portable-atomic-util.

I was aware that #41 uses a different implementation than std, but I missed the difference in API.

@taiki-e taiki-e added C-bug Category: related to a bug. A-portable-atomic-util Area: related to portable-atomic-util crate labels Dec 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-portable-atomic-util Area: related to portable-atomic-util crate C-bug Category: related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant