You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, accessing the associated constant does not:
let _ = Enum::Variant;// error[E0423]: expected value, found struct variant `Enum::Variant`
Explanation why I think this should work
Most items are in one of three namespaces/universes: The type namespace, the value namespace, and the macro namespace. For example, regular structs are in the type namespace, whereas constants are in the value namespace, so a struct and a constant can share the same name (this is also how unit structs are desugared):
structS{}constS:S = S{};let _:S = S;
I expected the same to work for enum variants as well.
If you don't intend to fix this, please consider changing the error message, as the phrase "struct variant" can be misleading.
Meta
It can be reproduced on stable, beta and nightly. See playground.
The text was updated successfully, but these errors were encountered:
The following code works:
However, accessing the associated constant does not:
Explanation why I think this should work
Most items are in one of three namespaces/universes: The type namespace, the value namespace, and the macro namespace. For example, regular structs are in the type namespace, whereas constants are in the value namespace, so a struct and a constant can share the same name (this is also how unit structs are desugared):
I expected the same to work for enum variants as well.
If you don't intend to fix this, please consider changing the error message, as the phrase "struct variant" can be misleading.
Meta
It can be reproduced on stable, beta and nightly. See playground.
The text was updated successfully, but these errors were encountered: