pub enum TypeKind {
Show 14 variants
Void,
Bool,
Int(IntKind),
Float(FloatKind),
Complex(FloatKind),
BitInt {
signed: bool,
width: u32,
},
Pointer(TypeId),
Atomic(TypeId),
Array {
elem: TypeId,
len: ArrayLen,
},
Function(FunctionId),
Vector {
elem: TypeId,
len: u32,
},
Record(RecordId),
Enum(EnumId),
Typedef {
name: Symbol,
underlying: TypeId,
},
}Expand description
What a type is, with its qualifiers stripped off into Type::quals.
This is Copy and sixteen bytes, which is what lets it be the interning key directly.
Function types and record types are the two that carry a variable amount of information,
and both of them are an index into a table this crate owns.
Variants§
Void
void.
Bool
bool, which C23 spells without an underscore and which is one byte with two values.
Int(IntKind)
One of the standard integer types.
Float(FloatKind)
One of the real floating types.
Complex(FloatKind)
_Complex T for a real floating T.
BitInt
_BitInt(N) and unsigned _BitInt(N).
A distinct kind rather than an integer type with a width, because these do not take part in the integer promotions and folding them in with the standard types is how that rule gets forgotten.
Fields
Pointer(TypeId)
A pointer to the given type.
Atomic(TypeId)
_Atomic(T), which is a type and not a qualifier. See Qualifiers.
Array
An array of the given element type.
Fields
Function(FunctionId)
A function type, whose parameter list is in this crate’s side table.
Vector
A GNU vector type, __attribute__((vector_size(n))).
Record(RecordId)
A struct or union, identified by its declaration rather than by its members.
Enum(EnumId)
An enum, identified by its declaration.
Typedef
A typedef name, which is sugar over whatever it was declared as.
Every semantic decision reads Types::canonical and never
sees this; every diagnostic reads the type as written and sees nothing else, so the
error says size_t rather than unsigned long. Compilers that drop the sugar produce
messages nobody can act on, and compilers that decide on the sugar produce wrong
answers, and both are common.