Function type_allowed_to_implement_copy

Source
pub fn type_allowed_to_implement_copy<'tcx>(
    tcx: TyCtxt<'tcx>,
    param_env: ParamEnv<'tcx>,
    self_type: Ty<'tcx>,
    parent_cause: ObligationCause<'tcx>,
    impl_safety: Safety,
) -> Result<(), CopyImplementationError<'tcx>>
Expand description

Checks that the fields of the type (an ADT) all implement copy.

If fields don’t implement copy, return an error containing a list of those violating fields.

If it’s not an ADT, int ty, bool, float ty, char, raw pointer, !, a reference or an array returns Err(NotAnAdt).

If the impl is Safe, self_type must not have unsafe fields. When used to generate suggestions in lints, Safe should be supplied so as to not suggest implementing Copy for types with unsafe fields.