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

Support MaybeUninit and ManuallyDrop #406

Closed
42triangles opened this issue Oct 22, 2019 · 6 comments
Closed

Support MaybeUninit and ManuallyDrop #406

42triangles opened this issue Oct 22, 2019 · 6 comments

Comments

@42triangles
Copy link

I think these should really be supported, as it is can be somewhat important when dealing with a C API. Since both are #[repr(transparent)], and since (afaik) C fields do not have to be initialized as long as they aren't being used, MaybeUninit<T> and ManuallyDrop<T> should probably be exopsed as whatever T would translated to on its own.

@emilio
Copy link
Collaborator

emilio commented Oct 23, 2019

This makes sense. We already hande other standard types, so I don't think it should be too terrible to fix.

@chrysn
Copy link

chrysn commented Mar 20, 2020

Would that allow writing C functions as pub extern "C" fn my_fun(x: &mut MaybeUninit<somestruct>)?

I'm trying to follow along the lines of what's there for NonNull and Cell, maybe I can come up with a PR.

@emilio
Copy link
Collaborator

emilio commented Mar 20, 2020

Yes it would.

@emilio
Copy link
Collaborator

emilio commented Mar 20, 2020

And yeah, doing what Cell does sounds alright.

@cceckman
Copy link

cceckman commented Nov 1, 2020

If I'm this comment, this is closed as of 0.15.0 (af6d2e3 in tree). @emilio / @Hywan can you confirm?

(Thanks for adding this!)

@emilio
Copy link
Collaborator

emilio commented Nov 2, 2020

Yes, that's right!

@emilio emilio closed this as completed Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants