See also #2208 for more on assignee expressions.
The following code compiles:
enum Never {}
enum Foo {
Variant,
}
enum Bar {
One,
Two(Never),
}
fn main() {
Foo::Variant = Foo::Variant;
Bar::One = Bar::One;
}
However, the reference doesn't say that enums can be used in assignee expressions. It only mentions that structs can be used there.
But based on how the compiler behaves, it seems that enums can be used in assignee expressions, as long as it's "irrefutable".
See also #2208 for more on assignee expressions.
The following code compiles:
However, the reference doesn't say that enums can be used in assignee expressions. It only mentions that structs can be used there.
But based on how the compiler behaves, it seems that enums can be used in assignee expressions, as long as it's "irrefutable".