Why does this code not compile?
enum Enumeration {
A,
B,
}
#[repr(transparent)]
struct NotZeroSized {
enumerated: Enumeration,
name: str,
}
I get
error[E0690]: transparent struct needs at most one non-zero-sized field, but has 2
--> src/lib.rs:7:1
|
7 | struct NotZeroSized {
| ^^^^^^^^^^^^^^^^^^^ needs at most one non-zero-sized field, but has 2
8 | enumerated: Enumeration,
| ----------------------- this field is non-zero-sized
9 | name: str,
| --------- this field is non-zero-sized
For more information about this error, try `rustc --explain E0690`.
error: could not compile `playground` due to previous error
but str
is not zero sized no?