Enum rustc::middle::trans::adt::ReprExperimental [-]  [+] [src]

pub enum Repr {
    CEnum(IntType, Disr, Disr),
    Univariant(Struct, bool),
    General(IntType, Vec<Struct>, bool),
    RawNullablePointer {
        pub nndiscr: Disr,
        pub nnty: t,
        pub nullfields: Vec<t>,
    },
    StructWrappedNullablePointer {
        pub nonnull: Struct,
        pub nndiscr: Disr,
        pub ptrfield: PointerField,
        pub nullfields: Vec<t>,
    },
}

Representations.

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

nndiscr
nnty
nullfields
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

nonnull
nndiscr
ptrfield
nullfields

Trait Implementations

Derived Implementations

impl Show for Repr

fn fmt(&self, __arg_0: &mut Formatter) -> Result

impl PartialEq for Repr

fn eq(&self, __arg_0: &Repr) -> bool

fn ne(&self, __arg_0: &Repr) -> bool

impl Eq for Repr

fn assert_receiver_is_total_eq(&self)