pub enum Repr<'tcx> {
CEnum(IntType, Disr, Disr),
Univariant(Struct<'tcx>, bool),
General(IntType, Vec<Struct<'tcx>>, bool),
RawNullablePointer {
// some fields omitted
},
StructWrappedNullablePointer {
// some fields omitted
},
}Variants
CEnum | C-like enums; basically an int.
|
Univariant | Single-case variants, and structs/tuples/records.
Structs with destructors need a dynamic destroyedness flag to
avoid running the destructor too many times; this is included
in the Struct if present.
|
General | General-case enums: for each case there is a struct, and they
all start with a field for the discriminant.
Types with destructors need a dynamic destroyedness flag to
avoid running the destructor too many times; the last argument
indicates whether such a flag is present.
|
RawNullablePointer | Two cases distinguished by a nullable pointer: the case with discriminant
nndiscr must have single field which is known to be nonnull due to its type.
The other case is known to be zero sized. Hence we represent the enum
as simply a nullable pointer: if not null it indicates the nndiscr variant,
otherwise it indicates the other case.
Fields
|
StructWrappedNullablePointer | Two cases distinguished by a nullable pointer: the case with discriminant
nndiscr is represented by the struct nonnull, where the ptrfieldth
field is known to be nonnull due to its type; if that field is null, then
it represents the other case, which is inhabited by at most one value
(and all other fields are undefined/unused).
For example, std::option::Option instantiated at a safe pointer type
is represented such that None is a null pointer and Some is the
identity function.
Fields
|
Trait Implementations
Derived Implementations
impl<'tcx> Show for Repr<'tcx>
impl<'tcx> Eq for Repr<'tcx>