You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But since that was written, we have access to the #[non_exhausive] attribute. I think it has the same functionality. Any reason we shouldn't be suggesting this instead?
Is there a benefit to adding #[non_exhaustive] or even having the _data member at all? PhantomData itself is a ZST no? Also I feel like you could just as well use () rather than u8 for the pointer just to further remove any suggestion that this is anything other than a trick to make an opaque FFI type. I might be missing something but wouldn't the following be just as good?
Section: https://doc.rust-lang.org/nomicon/ffi.html#representing-opaque-structs
Currently, it uses a struct like this:
But since that was written, we have access to the
#[non_exhausive]
attribute. I think it has the same functionality. Any reason we shouldn't be suggesting this instead?The text was updated successfully, but these errors were encountered: