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

RustCallStatus::error_buf is now ManuallyDrop and not MaybeUninit. #2173

Merged
merged 1 commit into from
Jul 2, 2024

Conversation

mhammond
Copy link
Member

error_buf is owned by the foreign side. Because we assume it has been initialized we use ManuallyDrop instead of MaybeUninit, which clarifies ownership and avoids unsafe code.

Fixes #2168

@mhammond mhammond force-pushed the push-pkvpppluwwzk branch from a9fdfaf to a47e239 Compare June 30, 2024 03:56
@mhammond mhammond marked this pull request as ready for review June 30, 2024 23:08
@mhammond mhammond requested a review from a team as a code owner June 30, 2024 23:08
@mhammond mhammond requested review from jeddai and removed request for a team June 30, 2024 23:08
Copy link
Contributor

@bendk bendk left a comment

Choose a reason for hiding this comment

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

This all looks right to me, I just had some docstring suggestions.

uniffi_core/src/ffi/rustcalls.rs Show resolved Hide resolved
uniffi_core/src/ffi/rustcalls.rs Show resolved Hide resolved
uniffi_core/src/ffi/rustcalls.rs Outdated Show resolved Hide resolved
uniffi_core/src/ffi/rustcalls.rs Show resolved Hide resolved
`error_buf` is owned by the foreign side. Because we assume it has been initialized
we use `ManuallyDrop` instead of `MaybeUninit`, which clarifies ownership
and avoids unsafe code.

Fixes mozilla#2168
@mhammond mhammond force-pushed the push-pkvpppluwwzk branch from a47e239 to 8246909 Compare July 2, 2024 17:52
@mhammond mhammond merged commit 8bc192e into mozilla:main Jul 2, 2024
5 checks passed
@mhammond mhammond deleted the push-pkvpppluwwzk branch July 2, 2024 18:11
@mgeisler
Copy link
Contributor

mgeisler commented Jul 3, 2024

Thanks a lot, @mhammond! Cc @maurer.

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.

RustCallStatus::error_buf should be ManuallyDrop, not MaybeUninit?
4 participants