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

[Feature] AliasableMut/AliasableBox could use #[repr(transparent)] #4

Open
talchas opened this issue Jul 4, 2021 · 1 comment
Open

Comments

@talchas
Copy link

talchas commented Jul 4, 2021

If a user wants to pass these directly for use in FFI (not directly the intended use, but plausible and related to some uses), they need to be repr(transparent). Similarly, they could possibly use as_mut_ptr()/into_raw() that do not ever construct a Unique/&mut reference to the target (which would also be a less-pleasant workaround for the first thing).

@avitex
Copy link
Owner

avitex commented Jul 13, 2021

This is a good idea.

  • alloc::boxed::Box doesn't seem to be transparent due to future support around non-zero size handles to allocators, which might be something that might be wanted to be supported here too in the future. As you said, a middle ground providing as_mut_ptr()/into_raw() could be a good idea.
  • AliasableMut seems like a good fit for being made repr(transparent) however!

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

No branches or pull requests

2 participants