Unreserve braced enum variants in value namespace by petrochenkov · Pull Request #103578 · rust-lang/rust (original) (raw)

Change description for the lang team.

Tuple structs/variants and unit structs/variants occupy slots in two namespaces, like described in RFC 1506 "Clarify the relationships between various kinds of structs and variants".

struct S; // type + value (constructor constant) struct S(u8); // type + value (constructor function) struct S { field: u8 } // only type

enum E { V, // type + value (constructor constant) V(u8), // type + value (constructor function) V { field: u8 }, // type + value (???) }

In addition to that braced variants (but not structs) occupy an additional slot in value namespace.
The value it refers to is unusable, it produces an error when referred to from an expression or pattern (it can be reexported around though, otherwise use wouldn't be usable with braced variants at all).

This special case for enum variants was introduced in early 2016 in #30882 as future proofing.
During the last 6 years no specific plans for putting these names into use were proposed.
Also we now have editions to introduce these names in the future if such proposals appear.

So this PR removes these dummy names from value namespace thus making the language more consistent and simplifying the compiler.