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

fn mem::transmute: Replace with sound Arc::from_raw(Arc::into_raw(…) as *const _) #1361

Merged
merged 2 commits into from
Sep 25, 2024

Conversation

kkysen
Copy link
Collaborator

@kkysen kkysen commented Sep 24, 2024

As @Darksonn pointed out, using mem::transmute on an Arc is unsound since it's not #[repr(transparent)], and we need to go through Arc::into_raw and Arc::from_raw with a ptr cast instead.

…...) as *const _)` as `Arc` is not `#[repr(transparent)]`.
@kkysen kkysen merged commit acd57b1 into main Sep 25, 2024
28 checks passed
@kkysen kkysen deleted the kkysen/Arc-from_raw-into_raw-instead-of-transmute branch September 25, 2024 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants