/// Adds the place into the used mutable variables set
Adds the place into the used mutable variables set
Adds the place into the used mutable variables set
fn add_used_mut<'d>(
        &mut self,
        root_place: RootPlace<'d, 'tcx>,
        flow_state: &Flows<'cx, 'gcx, 'tcx>,
    ) {
        match root_place {
            RootPlace {
                place: Place::Local(local),
                is_local_mutation_allowed,
            } => {
                if is_local_mutation_allowed != LocalMutationIsAllowed::Yes {
                    // If the local may be initialized, and it is now currently being
                    // mutated, then it is justified to be annotated with the `mut`
                    // keyword, since the mutation may be a possible reassignment.
                    let mpi = self.move_data.rev_lookup.find_local(*local);
                    let ii = &self.move_data.init_path_map[mpi];
                    for index in ii {
                        if flow_state.ever_inits.contains(index) {
                            self.used_mut.insert(*local);
                            break;
                        }
                    }
                }
            }
            RootPlace {
                place: _,
                is_local_mutation_allowed: LocalMutationIsAllowed::Yes,
            } => {}
            RootPlace {
                place: place @ Place::Projection(_),
                is_local_mutation_allowed: _,
            } => {
                if let Some(field) = place.is_upvar_field_projection(self.mir, &self.tcx) {
                    self.used_mut_upvars.push(field);
                }
            }
            RootPlace {
                place: Place::Promoted(..),
                is_local_mutation_allowed: _,
            } => {}
            RootPlace {
                place: Place::Static(..),
                is_local_mutation_allowed: _,
            } => {}
        }
    }
fn add_used_mut < ' d > ( & mut self , root_place : RootPlace < ' d , ' tcx > , flow_state : & Flows < ' cx , ' gcx , ' tcx > , ) { match root_place { RootPlace { place : Place :: Local ( local ) , is_local_mutation_allowed , } => { if is_local_mutation_allowed != LocalMutationIsAllowed :: Yes { // If the local may be initialized, and it is now currently being // mutated, then it is justified to be annotated with the `mut` // keyword, since the mutation may be a possible reassignment. let mpi = self . move_data . rev_lookup . find_local ( * local ) ; let ii = & self . move_data . init_path_map [ mpi ] ; for index in ii { if flow_state . ever_inits . contains ( index ) { self . used_mut . insert ( * local ) ; break ; } } } } RootPlace { place : _ , is_local_mutation_allowed : LocalMutationIsAllowed :: Yes , } => { } RootPlace { place : place @ Place :: Projection ( _ ) , is_local_mutation_allowed : _ , } => { if let Some ( field ) = place . is_upvar_field_projection ( self . mir , & self . tcx ) { self . used_mut_upvars . push ( field ) ; } } RootPlace { place : Place :: Promoted ( .. ) , is_local_mutation_allowed : _ , } => { } RootPlace { place : Place :: Static ( .. ) , is_local_mutation_allowed : _ , } => { } } }
Adds the place into the used mutable variables set
Adds the place into the used mutable variables set
&mut self
root_place
RootPlace<'d, 'tcx>
flow_state
&Flows<'cx, 'gcx, 'tcx>