pub struct EnumInfo {
pub tag: Option<Symbol>,
pub underlying: Option<TypeId>,
pub fixed: bool,
pub enumerators: Vec<Enumerator>,
}Expand description
What is known about one enum declaration.
Fields§
§tag: Option<Symbol>The tag, absent for an anonymous one.
underlying: Option<TypeId>The type the enumerators are represented in, absent until it is decided.
C23 lets the program write it, and before that it is chosen once every enumerator has been seen. Either way it is a fact about the declaration rather than about the type system, so it is recorded here and not derived twice.
fixed: boolWhether the underlying type was written by the program rather than chosen.
It changes the answer to what an enumerator’s own type is, and it decides whether an enumerator that does not fit is an error or a reason to widen.
enumerators: Vec<Enumerator>The enumerators in the order the program wrote them, empty until the enumeration is complete.
Nothing the type system itself asks about, since an enumerator is a name in a scope and what has the type is the enumeration rather than the list. It is here because the declaration is the only place the list ever exists, the scope it is declared into throws away the order and the tie to the enumeration, and a reader that wants the list later has nowhere else to ask. Debug information is that reader: without this a debugger prints the number where the program wrote the name.