crate fn compute(mir: &Mir<'tcx>) -> Self {
        let mut escaping_locals = EscapingLocals::compute(mir);

        let mut to_local = IndexVec::default();
        let mut escapes_into_return = 0;
        let mut no_regions = 0;
        let from_local: IndexVec<Local, Option<_>> = mir
            .local_decls
            .iter_enumerated()
            .map(|(local, local_decl)| {
                if escaping_locals.escapes_into_return(local) {
                    // If the local escapes into the return value,
                    // then the return value will force all of the
                    // regions in its type to outlive free regions
                    // (e.g., `'static`) and hence liveness is not
                    // needed. This is particularly important for big
                    // statics.
                    escapes_into_return += 1;
                    None
                } else if local_decl.ty.has_free_regions() {
                    let l = to_local.push(local);
                    debug!("liveness_map: {:?} = {:?}", local, l);
                    Some(l)
                } else {
                    no_regions += 1;
                    None
                }
            }).collect();

        debug!("liveness_map: {} variables need liveness", to_local.len());
        debug!("liveness_map: {} escapes into return", escapes_into_return);
        debug!("liveness_map: {} no regions", no_regions);

        Self {
            from_local,
            to_local,
        }
    }
/// Iterates over the variables in Mir and assigns each Local whose type contains
/// regions a LocalWithRegion index. Returns a map for converting back and forth.
Iterates over the variables in Mir and assigns each Local whose type contains
regions a LocalWithRegion index. Returns a map for converting back and forth.
Iterates over the variables in Mir and assigns each Local whose type contains regions a LocalWithRegion index . Returns a map for converting back and forth .
crate fn compute(mir: &Mir<'tcx>) -> Self {
        let mut escaping_locals = EscapingLocals::compute(mir);
        let mut to_local = IndexVec::default();
        let mut escapes_into_return = 0;
        let mut no_regions = 0;
        let from_local: IndexVec<Local, Option<_>> = mir
            .local_decls
            .iter_enumerated()
            .map(|(local, local_decl)| {
                if escaping_locals.escapes_into_return(local) {
                    // If the local escapes into the return value,
                    // then the return value will force all of the
                    // regions in its type to outlive free regions
                    // (e.g., `'static`) and hence liveness is not
                    // needed. This is particularly important for big
                    // statics.
                    escapes_into_return += 1;
                    None
                } else if local_decl.ty.has_free_regions() {
                    let l = to_local.push(local);
                    debug!("liveness_map: {:?} = {:?}", local, l);
                    Some(l)
                } else {
                    no_regions += 1;
                    None
                }
            }).collect();
        debug!("liveness_map: {} variables need liveness", to_local.len());
        debug!("liveness_map: {} escapes into return", escapes_into_return);
        debug!("liveness_map: {} no regions", no_regions);
        Self {
            from_local,
            to_local,
        }
    }
crate fn compute ( mir : & Mir < ' tcx > ) -> Self { let mut escaping_locals = EscapingLocals :: compute ( mir ) ; let mut to_local = IndexVec :: default ( ) ; let mut escapes_into_return = 0 ; let mut no_regions = 0 ; let from_local : IndexVec < Local , Option < _ > > = mir . local_decls . iter_enumerated ( ) . map ( | ( local , local_decl ) | { if escaping_locals . escapes_into_return ( local ) { // If the local escapes into the return value, // then the return value will force all of the // regions in its type to outlive free regions // (e.g., `'static`) and hence liveness is not // needed. This is particularly important for big // statics. escapes_into_return += 1 ; None } else if local_decl . ty . has_free_regions ( ) { let l = to_local . push ( local ) ; debug ! ( " " local l ) ; Some ( l ) } else { no_regions += 1 ; None } } ) . collect ( ) ; debug ! ( " " to_local len ( ) ) ; debug ! ( " " escapes_into_return ) ; debug ! ( " " no_regions ) ; Self { from_local , to_local , } }
Iterates over the variables in Mir and assigns each Local whose type contains
regions a LocalWithRegion index.
Iterates over the variables in Mir and assigns each Local whose type contains regions a LocalWithRegion index .
mir
&Mir<'tcx>