When implementing generics, I found an oversight in enum generation:
generator
.generate_enum("Foo")
.add_value("Bar")
.add_pub_field("bar", "u32");
// Generates:
enum Foo {
Bar {
pub bar: u32
}
}
This does not compile, as the variant fields inherit the visibility of their parent enum:
error[E0449]: visibility qualifiers are not permitted here
--> ...
|
3 | pub bar: u32
| ^^^
|
= note: enum variants and their fields always share the visibility of the enum they are in
This method appears to have been copied over from the struct generator code, as the documentation refers to structs. But it should be removed (or deprecated) from the enum variant code.
When implementing generics, I found an oversight in enum generation:
This does not compile, as the variant fields inherit the visibility of their parent enum:
This method appears to have been copied over from the struct generator code, as the documentation refers to structs. But it should be removed (or deprecated) from the enum variant code.