is_niche_optimization_candidate in rustc_lint::types - Rust
Description: A type is niche-optimization candidate iff:

Skip to main content

## 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.