Closed
Description
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:
#[repr(C)]
struct A {
// ...
no_copy: std::kinds::marker::NoCopy;
}
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.
Metadata
Metadata
Assignees
Labels
No labels