fn final_upvar_tys(&self, closure_id: ast::NodeId) -> Vec<Ty<'tcx>> {
        // Presently an unboxed closure type cannot "escape" out of a
        // function, so we will only encounter ones that originated in the
        // local crate or were inlined into it along with some function.
        // This may change if abstract return types of some sort are
        // implemented.
        let tcx = self.tcx;
        let closure_def_index = tcx.hir.local_def_id(closure_id);

        tcx.with_freevars(closure_id, |freevars| {
            freevars
                .iter()
                .map(|freevar| {
                    let var_node_id = freevar.var_id();
                    let var_hir_id = tcx.hir.node_to_hir_id(var_node_id);
                    let freevar_ty = self.node_ty(var_hir_id);
                    let upvar_id = ty::UpvarId {
                        var_id: var_hir_id,
                        closure_expr_id: LocalDefId::from_def_id(closure_def_index),
                    };
                    let capture = self.tables.borrow().upvar_capture(upvar_id);

                    debug!(
                        "var_id={:?} freevar_ty={:?} capture={:?}",
                        var_node_id,
                        freevar_ty,
                        capture
                    );

                    match capture {
                        ty::UpvarCapture::ByValue => freevar_ty,
                        ty::UpvarCapture::ByRef(borrow) => tcx.mk_ref(
                            borrow.region,
                            ty::TypeAndMut {
                                ty: freevar_ty,
                                mutbl: borrow.kind.to_mutbl_lossy(),
                            },
                        ),
                    }
                })
                .collect()
        })
    }
// Returns a list of `ClosureUpvar`s for each upvar.
Returns a list of `ClosureUpvar`s for each upvar.
Returns a list of ` ClosureUpvar ` s for each upvar .
fn final_upvar_tys(&self, closure_id: ast::NodeId) -> Vec<Ty<'tcx>> {
        // Presently an unboxed closure type cannot "escape" out of a
        // function, so we will only encounter ones that originated in the
        // local crate or were inlined into it along with some function.
        // This may change if abstract return types of some sort are
        // implemented.
        let tcx = self.tcx;
        let closure_def_index = tcx.hir.local_def_id(closure_id);
        tcx.with_freevars(closure_id, |freevars| {
            freevars
                .iter()
                .map(|freevar| {
                    let var_node_id = freevar.var_id();
                    let var_hir_id = tcx.hir.node_to_hir_id(var_node_id);
                    let freevar_ty = self.node_ty(var_hir_id);
                    let upvar_id = ty::UpvarId {
                        var_id: var_hir_id,
                        closure_expr_id: LocalDefId::from_def_id(closure_def_index),
                    };
                    let capture = self.tables.borrow().upvar_capture(upvar_id);
                    debug!(
                        "var_id={:?} freevar_ty={:?} capture={:?}",
                        var_node_id,
                        freevar_ty,
                        capture
                    );
                    match capture {
                        ty::UpvarCapture::ByValue => freevar_ty,
                        ty::UpvarCapture::ByRef(borrow) => tcx.mk_ref(
                            borrow.region,
                            ty::TypeAndMut {
                                ty: freevar_ty,
                                mutbl: borrow.kind.to_mutbl_lossy(),
                            },
                        ),
                    }
                })
                .collect()
        })
    }
fn final_upvar_tys ( & self , closure_id : ast :: NodeId ) -> Vec < Ty < ' tcx > > { // Presently an unboxed closure type cannot "escape" out of a // function, so we will only encounter ones that originated in the // local crate or were inlined into it along with some function. // This may change if abstract return types of some sort are // implemented. let tcx = self . tcx ; let closure_def_index = tcx . hir . local_def_id ( closure_id ) ; tcx . with_freevars ( closure_id , | freevars | { freevars . iter ( ) . map ( | freevar | { let var_node_id = freevar . var_id ( ) ; let var_hir_id = tcx . hir . node_to_hir_id ( var_node_id ) ; let freevar_ty = self . node_ty ( var_hir_id ) ; let upvar_id = ty :: UpvarId { var_id : var_hir_id , closure_expr_id : LocalDefId :: from_def_id ( closure_def_index ) , } ; let capture = self . tables . borrow ( ) . upvar_capture ( upvar_id ) ; debug ! ( " " var_node_id freevar_ty capture ) ; match capture { ty :: UpvarCapture :: ByValue => freevar_ty , ty :: UpvarCapture :: ByRef ( borrow ) => tcx . mk_ref ( borrow . region , ty :: TypeAndMut { ty : freevar_ty , mutbl : borrow . kind . to_mutbl_lossy ( ) , } , ) , } } ) . collect ( ) } ) }
Returns a list of `ClosureUpvar`s for each upvar.
Returns a list of ` ClosureUpvar ` s for each upvar .
&self
closure_id
ast::NodeId