hir_ty::layout

Type Alias Variants

source
pub type Variants = Variants<RustcFieldIdx, RustcEnumVariantIdx>;

Aliased Type§

enum Variants {
    Single {
        index: RustcEnumVariantIdx,
    },
    Multiple {
        tag: Scalar,
        tag_encoding: TagEncoding<RustcEnumVariantIdx>,
        tag_field: usize,
        variants: IndexVec<RustcEnumVariantIdx, LayoutData<RustcFieldIdx, RustcEnumVariantIdx>>,
    },
}

Variants§

§

Single

Single enum variants, structs/tuples, unions, and all non-ADTs.

Fields

§index: RustcEnumVariantIdx

Always 0 for non-enums/generators. For enums without a variant, this is an invalid index!

§

Multiple

Enum-likes with more than one variant: each variant comes with a discriminant (usually the same as the variant index but the user can assign explicit discriminant values). That discriminant is encoded as a tag on the machine. The layout of each variant is a struct, and they all have space reserved for the tag. For enums, the tag is the sole field of the layout.

Fields

§tag: Scalar
§tag_encoding: TagEncoding<RustcEnumVariantIdx>
§tag_field: usize
§variants: IndexVec<RustcEnumVariantIdx, LayoutData<RustcFieldIdx, RustcEnumVariantIdx>>