strum
strum copied to clipboard
When implementing `EnumString` on nested enum it requires `Default` implementation for nested enums
Code required to reproduce:
use strum::EnumString;
#[derive(Debug, Clone, Copy, EnumString)]
enum Nested {
EnumA(EnumA),
EnumB(EnumB),
}
#[derive(Debug, Clone, Copy, EnumString)]
enum EnumA {
Variant1,
Variant2,
}
#[derive(Debug, Clone, Copy, EnumString)]
enum EnumB {
Variant3,
Variant4,
}
fn main() {}
Error:
error[E0277]: the trait bound `EnumA: Default` is not satisfied
--> src/main.rs:3:30
|
3 | #[derive(Debug, Clone, Copy, EnumString)]
| ^^^^^^^^^^ the trait `Default` is not implemented for `EnumA`
|
= note: this error originates in the derive macro `EnumString` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `EnumB: Default` is not satisfied
--> src/main.rs:3:30
|
3 | #[derive(Debug, Clone, Copy, EnumString)]
| ^^^^^^^^^^ the trait `Default` is not implemented for `EnumB`
|
= note: this error originates in the derive macro `EnumString` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0277`.
error: could not compile `testing` (bin "testing") due to 2 previous errors