fn find_implied_output_region<I>(&self,
                                     input_tys: &[Ty<'tcx>],
                                     parent: Option<hir::BodyId>,
                                     input_indices: I) -> ElidedLifetime
        where I: Iterator<Item=usize>
    {
        let tcx = self.tcx();
        let mut lifetimes_for_params = Vec::with_capacity(input_tys.len());
        let mut possible_implied_output_region = None;
        let mut lifetimes = 0;

        for (input_type, index) in input_tys.iter().zip(input_indices) {
            let mut regions = FxHashSet();
            let have_bound_regions = tcx.collect_regions(input_type, &mut regions);

            debug!("find_implied_output_regions: collected {:?} from {:?} \
                    have_bound_regions={:?}", &regions, input_type, have_bound_regions);

            lifetimes += regions.len();

            if lifetimes == 1 && regions.len() == 1 {
                // there's a chance that the unique lifetime of this
                // iteration will be the appropriate lifetime for output
                // parameters, so lets store it.
                possible_implied_output_region = regions.iter().cloned().next();
            }

            lifetimes_for_params.push(ElisionFailureInfo {
                parent: parent,
                index: index,
                lifetime_count: regions.len(),
                have_bound_regions: have_bound_regions
            });
        }

        if lifetimes == 1 {
            Ok(*possible_implied_output_region.unwrap())
        } else {
            Err(Some(lifetimes_for_params))
        }
    }
/// Returns the appropriate lifetime to use for any output lifetimes
/// (if one exists) and a vector of the (pattern, number of lifetimes)
/// corresponding to each input type/pattern.
Returns the appropriate lifetime to use for any output lifetimes
(if one exists) and a vector of the (pattern, number of lifetimes)
corresponding to each input type/pattern.
Returns the appropriate lifetime to use for any output lifetimes ( if one exists ) and a vector of the ( pattern number of lifetimes ) corresponding to each input type / pattern .
fn find_implied_output_region<I>(&self,
                                     input_tys: &[Ty<'tcx>],
                                     parent: Option<hir::BodyId>,
                                     input_indices: I) -> ElidedLifetime
        where I: Iterator<Item=usize>
    {
        let tcx = self.tcx();
        let mut lifetimes_for_params = Vec::with_capacity(input_tys.len());
        let mut possible_implied_output_region = None;
        let mut lifetimes = 0;
        for (input_type, index) in input_tys.iter().zip(input_indices) {
            let mut regions = FxHashSet();
            let have_bound_regions = tcx.collect_regions(input_type, &mut regions);
            debug!("find_implied_output_regions: collected {:?} from {:?} \
                    have_bound_regions={:?}", &regions, input_type, have_bound_regions);
            lifetimes += regions.len();
            if lifetimes == 1 && regions.len() == 1 {
                // there's a chance that the unique lifetime of this
                // iteration will be the appropriate lifetime for output
                // parameters, so lets store it.
                possible_implied_output_region = regions.iter().cloned().next();
            }
            lifetimes_for_params.push(ElisionFailureInfo {
                parent: parent,
                index: index,
                lifetime_count: regions.len(),
                have_bound_regions: have_bound_regions
            });
        }
        if lifetimes == 1 {
            Ok(*possible_implied_output_region.unwrap())
        } else {
            Err(Some(lifetimes_for_params))
        }
    }
fn find_implied_output_region < I > ( & self , input_tys : & [ Ty < ' tcx > ] , parent : Option < hir :: BodyId > , input_indices : I ) -> ElidedLifetime where I : Iterator < Item = usize > { let tcx = self . tcx ( ) ; let mut lifetimes_for_params = Vec :: with_capacity ( input_tys . len ( ) ) ; let mut possible_implied_output_region = None ; let mut lifetimes = 0 ; for ( input_type , index ) in input_tys . iter ( ) . zip ( input_indices ) { let mut regions = FxHashSet ( ) ; let have_bound_regions = tcx . collect_regions ( input_type , & mut regions ) ; debug ! ( " \
 " regions input_type have_bound_regions ) ; lifetimes += regions . len ( ) ; if lifetimes == 1 && regions . len ( ) == 1 { // there's a chance that the unique lifetime of this // iteration will be the appropriate lifetime for output // parameters, so lets store it. possible_implied_output_region = regions . iter ( ) . cloned ( ) . next ( ) ; } lifetimes_for_params . push ( ElisionFailureInfo { parent : parent , index : index , lifetime_count : regions . len ( ) , have_bound_regions : have_bound_regions } ) ; } if lifetimes == 1 { Ok ( * possible_implied_output_region . unwrap ( ) ) } else { Err ( Some ( lifetimes_for_params ) ) } }
Returns the appropriate lifetime to use for any output lifetimes
(if one exists) and a vector of the (pattern, number of lifetimes)
corresponding to each input type/pattern.
Returns the appropriate lifetime to use for any output lifetimes ( if one exists ) and a vector of the ( pattern number of lifetimes ) corresponding to each input type / pattern .
&self
input_tys
&[Ty<'tcx>]
parent
Option<hir::BodyId>
input_indices
I