rustc_hir_analysis::impl_wf_check::min_specialization

Function get_impl_args

Source
fn get_impl_args(
    tcx: TyCtxt<'_>,
    impl1_def_id: LocalDefId,
    impl2_node: Node,
) -> Result<(GenericArgsRef<'_>, GenericArgsRef<'_>), ErrorGuaranteed>
Expand description

Given a specializing impl impl1, and the base impl impl2, returns two generic parameters (S1, S2) that equate their trait references. The returned types are expressed in terms of the generics of impl1.

Example

impl<A, B> Foo<A> for B { /* impl2 */ }
impl<C> Foo<Vec<C>> for C { /* impl1 */ }

Would return S1 = [C] and S2 = [Vec<C>, C].