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
This issue was labelled with: in the Rust repository
If I get a struct by pointer from a foreign library, and I know the structure cannot safely be copied because the actual object is larger than the struct, I want to declare it as something like this:
Now the compiler complains at use site that the struct is not foreign-function-safe.
As the markers are zero-sized, they have no bearing on the layout and no consequences for the structure data, so they, as long as any other zero-sized structures, should not waive FFS.
@thestinger suggests the same should apply to structures with one field as well, but I'm not so certain about that: there could be optimizations regarding alignment which would not be compatible with the (default) C ABI.
The text was updated successfully, but these errors were encountered:
Wednesday Oct 01, 2014 at 09:56 GMT
For earlier discussion, see rust-lang/rust#17679
This issue was labelled with: in the Rust repository
If I get a struct by pointer from a foreign library, and I know the structure cannot safely be copied because the actual object is larger than the struct, I want to declare it as something like this:
Now the compiler complains at use site that the struct is not foreign-function-safe.
As the markers are zero-sized, they have no bearing on the layout and no consequences for the structure data, so they, as long as any other zero-sized structures, should not waive FFS.
@thestinger suggests the same should apply to structures with one field as well, but I'm not so certain about that: there could be optimizations regarding alignment which would not be compatible with the (default) C ABI.
The text was updated successfully, but these errors were encountered: