pub(super) fn codegen_tag_value<'tcx, V>(
cx: &impl CodegenMethods<'tcx, Value = V>,
variant_index: VariantIdx,
layout: TyAndLayout<'tcx>,
) -> Result<Option<(FieldIdx, V)>, UninhabitedVariantError>Expand description
Calculates the value that needs to be stored to mark the discriminant.
This might be None for a struct or a niched variant (like Some(&3)).
If it’s Some, it returns the value to store and the field in which to
store it. Note that this value is not the same as the discriminant, in
general, as it might be a niche value or have a different size.
It might also be an Err because the variant is uninhabited.