pub fn overlapping_impls<'gcx, F1, F2, R>(
    tcx: TyCtxt<'_, 'gcx, 'gcx>,
    impl1_def_id: DefId,
    impl2_def_id: DefId,
    intercrate_mode: IntercrateMode,
    on_overlap: F1,
    no_overlap: F2,
) -> R
where
    F1: FnOnce(OverlapResult<'_>) -> R,
    F2: FnOnce() -> R,
{
    debug!("overlapping_impls(\
           impl1_def_id={:?}, \
           impl2_def_id={:?},
           intercrate_mode={:?})",
           impl1_def_id,
           impl2_def_id,
           intercrate_mode);

    let overlaps = tcx.infer_ctxt().enter(|infcx| {
        let selcx = &mut SelectionContext::intercrate(&infcx, intercrate_mode);
        overlap(selcx, impl1_def_id, impl2_def_id).is_some()
    });

    if !overlaps {
        return no_overlap();
    }

    // In the case where we detect an error, run the check again, but
    // this time tracking intercrate ambuiguity causes for better
    // diagnostics. (These take time and can lead to false errors.)
    tcx.infer_ctxt().enter(|infcx| {
        let selcx = &mut SelectionContext::intercrate(&infcx, intercrate_mode);
        selcx.enable_tracking_intercrate_ambiguity_causes();
        on_overlap(overlap(selcx, impl1_def_id, impl2_def_id).unwrap())
    })
}
/// If there are types that satisfy both impls, invokes `on_overlap`
/// with a suitably-freshened `ImplHeader` with those types
/// substituted. Otherwise, invokes `no_overlap`.
If there are types that satisfy both impls, invokes `on_overlap`
with a suitably-freshened `ImplHeader` with those types
substituted.
If there are types that satisfy both impls invokes ` on_overlap ` with a suitably - freshened ` ImplHeader ` with those types substituted .
pub fn overlapping_impls<'gcx, F1, F2, R>(
    tcx: TyCtxt<'_, 'gcx, 'gcx>,
    impl1_def_id: DefId,
    impl2_def_id: DefId,
    intercrate_mode: IntercrateMode,
    on_overlap: F1,
    no_overlap: F2,
) -> R
where
    F1: FnOnce(OverlapResult<'_>) -> R,
    F2: FnOnce() -> R,
{
    debug!("overlapping_impls(\
           impl1_def_id={:?}, \
           impl2_def_id={:?},
           intercrate_mode={:?})",
           impl1_def_id,
           impl2_def_id,
           intercrate_mode);
    let overlaps = tcx.infer_ctxt().enter(|infcx| {
        let selcx = &mut SelectionContext::intercrate(&infcx, intercrate_mode);
        overlap(selcx, impl1_def_id, impl2_def_id).is_some()
    });
    if !overlaps {
        return no_overlap();
    }
    // In the case where we detect an error, run the check again, but
    // this time tracking intercrate ambuiguity causes for better
    // diagnostics. (These take time and can lead to false errors.)
    tcx.infer_ctxt().enter(|infcx| {
        let selcx = &mut SelectionContext::intercrate(&infcx, intercrate_mode);
        selcx.enable_tracking_intercrate_ambiguity_causes();
        on_overlap(overlap(selcx, impl1_def_id, impl2_def_id).unwrap())
    })
}
pub fn overlapping_impls < ' gcx , F1 , F2 , R > ( tcx : TyCtxt < ' _ , ' gcx , ' gcx > , impl1_def_id : DefId , impl2_def_id : DefId , intercrate_mode : IntercrateMode , on_overlap : F1 , no_overlap : F2 , ) -> R where F1 : FnOnce ( OverlapResult < ' _ > ) -> R , F2 : FnOnce ( ) -> R , { debug ! ( " \
 \
 " impl1_def_id impl2_def_id intercrate_mode ) ; let overlaps = tcx . infer_ctxt ( ) . enter ( | infcx | { let selcx = & mut SelectionContext :: intercrate ( & infcx , intercrate_mode ) ; overlap ( selcx , impl1_def_id , impl2_def_id ) . is_some ( ) } ) ; if ! overlaps { return no_overlap ( ) ; } // In the case where we detect an error, run the check again, but // this time tracking intercrate ambuiguity causes for better // diagnostics. (These take time and can lead to false errors.) tcx . infer_ctxt ( ) . enter ( | infcx | { let selcx = & mut SelectionContext :: intercrate ( & infcx , intercrate_mode ) ; selcx . enable_tracking_intercrate_ambiguity_causes ( ) ; on_overlap ( overlap ( selcx , impl1_def_id , impl2_def_id ) . unwrap ( ) ) } ) }
If there are types that satisfy both impls, invokes `on_overlap`
with a suitably-freshened `ImplHeader` with those types
substituted.
If there are types that satisfy both impls invokes ` on_overlap ` with a suitably - freshened ` ImplHeader ` with those types substituted .
tcx
TyCtxt<'_, 'gcx, 'gcx>
impl1_def_id
DefId
impl2_def_id
DefId
intercrate_mode
IntercrateMode
on_overlap
F1
no_overlap
F2