Function rustc_hir_analysis::check::compare_impl_item::check_type_bounds
source · pub(super) fn check_type_bounds<'tcx>(
tcx: TyCtxt<'tcx>,
trait_ty: AssocItem,
impl_ty: AssocItem,
impl_trait_ref: TraitRef<'tcx>,
) -> Result<(), ErrorGuaranteed>
Expand description
Validate that ProjectionCandidate
s created for this associated type will
be valid.
Usually given
trait X { type Y: Copy } impl X for T { type Y = S; }
We are able to normalize <T as X>::Y
to S
, and so when we check the
impl is well-formed we have to prove S: Copy
.
For default associated types the normalization is not possible (the value from the impl could be overridden). We also can’t normalize generic associated types (yet) because they contain bound parameters.