rustc_lint::types

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”).
  • Has no fields.
  • Does not have the #[non_exhaustive] attribute.