pub(super) fn move_spans(
        &self,
        moved_place: &Place<'tcx>, // Could also be an upvar.
        location: Location,
    ) -> UseSpans {
        use self::UseSpans::*;
        use rustc::hir::ExprKind::Closure;
        use rustc::mir::AggregateKind;

        let stmt = match self.mir[location.block]
            .statements
            .get(location.statement_index)
        {
            Some(stmt) => stmt,
            None => return OtherUse(self.mir.source_info(location).span),
        };

        if let StatementKind::Assign(_, Rvalue::Aggregate(ref kind, ref places)) = stmt.kind {
            if let AggregateKind::Closure(def_id, _) = **kind {
                debug!("find_closure_move_span: found closure {:?}", places);

                if let Some(node_id) = self.tcx.hir.as_local_node_id(def_id) {
                    if let Closure(_, _, _, args_span, _) = self.tcx.hir.expect_expr(node_id).node {
                        if let Some(var_span) = self.tcx.with_freevars(node_id, |freevars| {
                            for (v, place) in freevars.iter().zip(places) {
                                match place {
                                    Operand::Copy(place) | Operand::Move(place)
                                        if moved_place == place =>
                                    {
                                        debug!(
                                            "find_closure_move_span: found captured local {:?}",
                                            place
                                        );
                                        return Some(v.span);
                                    }
                                    _ => {}
                                }
                            }
                            None
                        }) {
                            return ClosureUse {
                                args_span,
                                var_span,
                            };
                        }
                    }
                }
            }
        }

        return OtherUse(stmt.source_info.span);
    }
/// Finds the spans associated to a move or copy of move_place at location.
Finds the spans associated to a move or copy of move_place at location.
Finds the spans associated to a move or copy of move_place at location .
pub(super) fn move_spans(
        &self,
        moved_place: &Place<'tcx>, // Could also be an upvar.
        location: Location,
    ) -> UseSpans {
        use self::UseSpans::*;
        use rustc::hir::ExprKind::Closure;
        use rustc::mir::AggregateKind;
        let stmt = match self.mir[location.block]
            .statements
            .get(location.statement_index)
        {
            Some(stmt) => stmt,
            None => return OtherUse(self.mir.source_info(location).span),
        };
        if let StatementKind::Assign(_, Rvalue::Aggregate(ref kind, ref places)) = stmt.kind {
            if let AggregateKind::Closure(def_id, _) = **kind {
                debug!("find_closure_move_span: found closure {:?}", places);
                if let Some(node_id) = self.tcx.hir.as_local_node_id(def_id) {
                    if let Closure(_, _, _, args_span, _) = self.tcx.hir.expect_expr(node_id).node {
                        if let Some(var_span) = self.tcx.with_freevars(node_id, |freevars| {
                            for (v, place) in freevars.iter().zip(places) {
                                match place {
                                    Operand::Copy(place) | Operand::Move(place)
                                        if moved_place == place =>
                                    {
                                        debug!(
                                            "find_closure_move_span: found captured local {:?}",
                                            place
                                        );
                                        return Some(v.span);
                                    }
                                    _ => {}
                                }
                            }
                            None
                        }) {
                            return ClosureUse {
                                args_span,
                                var_span,
                            };
                        }
                    }
                }
            }
        }
        return OtherUse(stmt.source_info.span);
    }
pub ( super ) fn move_spans ( & self , moved_place : & Place < ' tcx > , // Could also be an upvar. location : Location , ) -> UseSpans { use self :: UseSpans :: * ; use rustc :: hir :: ExprKind :: Closure ; use rustc :: mir :: AggregateKind ; let stmt = match self . mir [ location . block ] . statements . get ( location . statement_index ) { Some ( stmt ) => stmt , None => return OtherUse ( self . mir . source_info ( location ) . span ) , } ; if let StatementKind :: Assign ( _ , Rvalue :: Aggregate ( ref kind , ref places ) ) = stmt . kind { if let AggregateKind :: Closure ( def_id , _ ) = * * kind { debug ! ( " " places ) ; if let Some ( node_id ) = self . tcx . hir . as_local_node_id ( def_id ) { if let Closure ( _ , _ , _ , args_span , _ ) = self . tcx . hir . expect_expr ( node_id ) . node { if let Some ( var_span ) = self . tcx . with_freevars ( node_id , | freevars | { for ( v , place ) in freevars . iter ( ) . zip ( places ) { match place { Operand :: Copy ( place ) | Operand :: Move ( place ) if moved_place == place => { debug ! ( " " place ) ; return Some ( v . span ) ; } _ => { } } } None } ) { return ClosureUse { args_span , var_span , } ; } } } } } return OtherUse ( stmt . source_info . span ) ; }
Finds the spans associated to a move or copy of move_place at location.
Finds the spans associated to a move or copy of move_place at location .
&self
moved_place
&Place<'tcx>
location
Location
&self
moved_place
&Place<'tcx>
location
Location