## is_niche_optimization_candidate

# Function is_niche_optimization_candidate

Source

    fn is_niche_optimization_candidate<'tcx>(
        tcx: TyCtxt<'tcx>,
        typing_env: TypingEnv<'tcx>,
        ty: Ty<'tcx>,
    ) -> bool

Expand description

A type is niche-optimization candidate iff:

- Is a zero-sized type with alignment 1 (a “1-ZST”).
- Is either a struct/tuple with no fields, or an enum with no variants.
- Does not have the `#[non_exhaustive]` attribute.