rustc_codegen_llvm::debuginfo::metadata::enums

Function compute_discriminant_value

Source
fn compute_discriminant_value<'ll, 'tcx>(
    cx: &CodegenCx<'ll, 'tcx>,
    enum_type_and_layout: TyAndLayout<'tcx>,
    variant_index: VariantIdx,
) -> DiscrResult
Expand description

Returns the discriminant value corresponding to the variant index.

Will return None if there is less than two variants (because then the enum won’t have) a tag, and if this is the untagged variant of a niche-layout enum (because then there is no single discriminant value).