rustc_const_eval::util

Function relate_types

Source
pub fn relate_types<'tcx>(
    tcx: TyCtxt<'tcx>,
    typing_env: TypingEnv<'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.