[−][src]Function rustc_typeck::impl_wf_check::min_specialization::check_duplicate_params

pub(in impl_wf_check::min_specialization) fn check_duplicate_params<'tcx>(
    tcx: TyCtxt<'tcx>,
    impl1_substs: SubstsRef<'tcx>,
    parent_substs: &Vec<GenericArg<'tcx>>,
    span: Span
)

Check that parameters of the derived impl don't occur more than once in the equated substs of the base impl.

For example forbid the following:

impl Tr for A { } impl Tr for (B, B) { }

Note that only consider the unconstrained parameters of the base impl:

impl<S, I: IntoIterator<Item = S>> Tr for I { } impl Tr for Vec { }

The substs for the parent impl here are [T, Vec<T>], which repeats T, but S is constrained in the parent impl, so parent_substs is only [Vec<T>]. This means we allow this impl.