rustc_trait_selection::traits::specialize

Function specializes

Source
pub(super) fn specializes(
    tcx: TyCtxt<'_>,
    (specializing_impl_def_id, parent_impl_def_id): (DefId, DefId),
) -> bool
Expand description

Is specializing_impl_def_id a specialization of parent_impl_def_id?

For every type that could apply to specializing_impl_def_id, we prove that the parent_impl_def_id also applies (i.e. it has a valid impl header and its where-clauses hold).

For the purposes of const traits, we also check that the specializing impl is not more restrictive than the parent impl. That is, if the parent_impl_def_id is a const impl (conditionally based off of some ~const bounds), then specializing_impl_def_id must also be const for the same set of types.