regular extern types have fully unknown size and alignment. currently this is done by making size_of_val
and align_of_val
.
however, in many cases it may be desirable to have a thin DST with known alignment and unknown size. importantly, this will allow getting the offset of a trailing opaque field, even the struct has other fields.
the syntax would be very simple, for example:
extern {
#[align(1)]
type TrailingBytes;
}
in this case the align attribute specifies an exact alignment, since there are no other factors visible to the compiler that could affect alignment.