pub fn relate_types<'tcx>(
    tcx: TyCtxt<'tcx>,
    param_env: ParamEnv<'tcx>,
    variance: Variance,
    src: Ty<'tcx>,
    dest: Ty<'tcx>
) -> bool
Expand description

Returns whether src is a subtype of dest, i.e. src <: dest.

When validating assignments, the variance should be Covariant. When checking during MirPhase >= MirPhase::Runtime(RuntimePhase::Initial) variance should be Invariant because we want to check for type equality.

This mostly ignores opaque types as it can be used in constraining contexts while still computing the final underlying type.