rustc_ty_utils::structural_match

Function has_structural_eq_impl

Source
fn has_structural_eq_impl<'tcx>(tcx: TyCtxt<'tcx>, adt_ty: Ty<'tcx>) -> bool
Expand description

This method returns true if and only if adt_ty itself has been marked as eligible for structural-match: namely, if it implements StructuralPartialEq (which is injected by #[derive(PartialEq)]).

Note that this does not recursively check if the substructure of adt_ty implements the trait.