fn split_auto_traits<'a, 'b, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
                                         trait_bounds: Vec<&'b hir::PolyTraitRef>)
    -> (Vec<DefId>, Vec<&'b hir::PolyTraitRef>)
{
    let (auto_traits, trait_bounds): (Vec<_>, _) = trait_bounds.into_iter().partition(|bound| {
        match bound.trait_ref.path.def {
            Def::Trait(trait_did) => {
                // Checks whether `trait_did` refers to one of the builtin
                // traits, like `Send`, and adds it to `auto_traits` if so.
                if Some(trait_did) == tcx.lang_items.send_trait() ||
                    Some(trait_did) == tcx.lang_items.sync_trait() {
                    let segments = &bound.trait_ref.path.segments;
                    let parameters = &segments[segments.len() - 1].parameters;
                    if !parameters.types().is_empty() {
                        check_type_argument_count(tcx, bound.trait_ref.path.span,
                                                  parameters.types().len(), &[]);
                    }
                    if !parameters.lifetimes().is_empty() {
                        report_lifetime_number_error(tcx, bound.trait_ref.path.span,
                                                     parameters.lifetimes().len(), 0);
                    }
                    true
                } else {
                    false
                }
            }
            _ => false
        }
    });

    let auto_traits = auto_traits.into_iter().map(|tr| {
        if let Def::Trait(trait_did) = tr.trait_ref.path.def {
            trait_did
        } else {
            unreachable!()
        }
    }).collect::<Vec<_>>();

    (auto_traits, trait_bounds)
}
/// Divides a list of general trait bounds into two groups: builtin bounds (Sync/Send) and the
/// remaining general trait bounds.
Divides a list of general trait bounds into two groups: builtin bounds (Sync/Send) and the
remaining general trait bounds.
Divides a list of general trait bounds into two groups : builtin bounds ( Sync / Send ) and the remaining general trait bounds .
fn split_auto_traits<'a, 'b, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
                                         trait_bounds: Vec<&'b hir::PolyTraitRef>)
    -> (Vec<DefId>, Vec<&'b hir::PolyTraitRef>)
{
    let (auto_traits, trait_bounds): (Vec<_>, _) = trait_bounds.into_iter().partition(|bound| {
        match bound.trait_ref.path.def {
            Def::Trait(trait_did) => {
                // Checks whether `trait_did` refers to one of the builtin
                // traits, like `Send`, and adds it to `auto_traits` if so.
                if Some(trait_did) == tcx.lang_items.send_trait() ||
                    Some(trait_did) == tcx.lang_items.sync_trait() {
                    let segments = &bound.trait_ref.path.segments;
                    let parameters = &segments[segments.len() - 1].parameters;
                    if !parameters.types().is_empty() {
                        check_type_argument_count(tcx, bound.trait_ref.path.span,
                                                  parameters.types().len(), &[]);
                    }
                    if !parameters.lifetimes().is_empty() {
                        report_lifetime_number_error(tcx, bound.trait_ref.path.span,
                                                     parameters.lifetimes().len(), 0);
                    }
                    true
                } else {
                    false
                }
            }
            _ => false
        }
    });
    let auto_traits = auto_traits.into_iter().map(|tr| {
        if let Def::Trait(trait_did) = tr.trait_ref.path.def {
            trait_did
        } else {
            unreachable!()
        }
    }).collect::<Vec<_>>();
    (auto_traits, trait_bounds)
}
fn split_auto_traits < ' a , ' b , ' gcx , ' tcx > ( tcx : TyCtxt < ' a , ' gcx , ' tcx > , trait_bounds : Vec < & ' b hir :: PolyTraitRef > ) -> ( Vec < DefId > , Vec < & ' b hir :: PolyTraitRef > ) { let ( auto_traits , trait_bounds ) : ( Vec < _ > , _ ) = trait_bounds . into_iter ( ) . partition ( | bound | { match bound . trait_ref . path . def { Def :: Trait ( trait_did ) => { // Checks whether `trait_did` refers to one of the builtin // traits, like `Send`, and adds it to `auto_traits` if so. if Some ( trait_did ) == tcx . lang_items . send_trait ( ) || Some ( trait_did ) == tcx . lang_items . sync_trait ( ) { let segments = & bound . trait_ref . path . segments ; let parameters = & segments [ segments . len ( ) - 1 ] . parameters ; if ! parameters . types ( ) . is_empty ( ) { check_type_argument_count ( tcx , bound . trait_ref . path . span , parameters . types ( ) . len ( ) , & [ ] ) ; } if ! parameters . lifetimes ( ) . is_empty ( ) { report_lifetime_number_error ( tcx , bound . trait_ref . path . span , parameters . lifetimes ( ) . len ( ) , 0 ) ; } true } else { false } } _ => false } } ) ; let auto_traits = auto_traits . into_iter ( ) . map ( | tr | { if let Def :: Trait ( trait_did ) = tr . trait_ref . path . def { trait_did } else { unreachable ! ( ) } } ) . collect :: < Vec < _ > > ( ) ; ( auto_traits , trait_bounds ) }
Divides a list of general trait bounds into two groups: builtin bounds (Sync/Send) and the
remaining general trait bounds.
Divides a list of general trait bounds into two groups : builtin bounds ( Sync / Send ) and the remaining general trait bounds .
tcx
TyCtxt<'a, 'gcx, 'tcx>
trait_bounds
Vec<&'b hir::PolyTraitRef>