pub(super) fn each_borrow_involving_path<'a, 'tcx, 'gcx: 'tcx, F, I, S> (
    s: &mut S,
    tcx: TyCtxt<'a, 'gcx, 'tcx>,
    mir: &Mir<'tcx>,
    _context: Context,
    access_place: (ShallowOrDeep, &Place<'tcx>),
    borrow_set: &BorrowSet<'tcx>,
    candidates: I,
    mut op: F,
) where
    F: FnMut(&mut S, BorrowIndex, &BorrowData<'tcx>) -> Control,
    I: Iterator<Item=BorrowIndex>
{
    let (access, place) = access_place;

    // FIXME: analogous code in check_loans first maps `place` to
    // its base_path.

    // check for loan restricting path P being used. Accounts for
    // borrows of P, P.a.b, etc.
    for i in candidates {
        let borrowed = &borrow_set[i];

        if places_conflict::places_conflict(tcx, mir, &borrowed.borrowed_place, place, access) {
            debug!(
                "each_borrow_involving_path: {:?} @ {:?} vs. {:?}/{:?}",
                i, borrowed, place, access
            );
            let ctrl = op(s, i, borrowed);
            if ctrl == Control::Break {
                return;
            }
        }
    }
}
/// Encapsulates the idea of iterating over every borrow that involves a particular path
Encapsulates the idea of iterating over every borrow that involves a particular path
Encapsulates the idea of iterating over every borrow that involves a particular path
pub(super) fn each_borrow_involving_path<'a, 'tcx, 'gcx: 'tcx, F, I, S> (
    s: &mut S,
    tcx: TyCtxt<'a, 'gcx, 'tcx>,
    mir: &Mir<'tcx>,
    _context: Context,
    access_place: (ShallowOrDeep, &Place<'tcx>),
    borrow_set: &BorrowSet<'tcx>,
    candidates: I,
    mut op: F,
) where
    F: FnMut(&mut S, BorrowIndex, &BorrowData<'tcx>) -> Control,
    I: Iterator<Item=BorrowIndex>
{
    let (access, place) = access_place;
    // FIXME: analogous code in check_loans first maps `place` to
    // its base_path.
    // check for loan restricting path P being used. Accounts for
    // borrows of P, P.a.b, etc.
    for i in candidates {
        let borrowed = &borrow_set[i];
        if places_conflict::places_conflict(tcx, mir, &borrowed.borrowed_place, place, access) {
            debug!(
                "each_borrow_involving_path: {:?} @ {:?} vs. {:?}/{:?}",
                i, borrowed, place, access
            );
            let ctrl = op(s, i, borrowed);
            if ctrl == Control::Break {
                return;
            }
        }
    }
}
pub ( super ) fn each_borrow_involving_path < ' a , ' tcx , ' gcx : ' tcx , F , I , S > ( s : & mut S , tcx : TyCtxt < ' a , ' gcx , ' tcx > , mir : & Mir < ' tcx > , _context : Context , access_place : ( ShallowOrDeep , & Place < ' tcx > ) , borrow_set : & BorrowSet < ' tcx > , candidates : I , mut op : F , ) where F : FnMut ( & mut S , BorrowIndex , & BorrowData < ' tcx > ) -> Control , I : Iterator < Item = BorrowIndex > { let ( access , place ) = access_place ; // FIXME: analogous code in check_loans first maps `place` to // its base_path. // check for loan restricting path P being used. Accounts for // borrows of P, P.a.b, etc. for i in candidates { let borrowed = & borrow_set [ i ] ; if places_conflict :: places_conflict ( tcx , mir , & borrowed . borrowed_place , place , access ) { debug ! ( " " i borrowed place access ) ; let ctrl = op ( s , i , borrowed ) ; if ctrl == Control :: Break { return ; } } } }
Encapsulates the idea of iterating over every borrow that involves a particular path
Encapsulates the idea of iterating over every borrow that involves a particular path
s
&mut S
tcx
TyCtxt<'a, 'gcx, 'tcx>
mir
&Mir<'tcx>
_context
Context
access_place
(ShallowOrDeep, &Place<'tcx>)
borrow_set
&BorrowSet<'tcx>
candidates
I
op
F
s
&mut S
tcx
TyCtxt<'a, 'gcx, 'tcx>
mir
&Mir<'tcx>
_context
Context
access_place
(ShallowOrDeep, &Place<'tcx>)
borrow_set
&BorrowSet<'tcx>
candidates
I
op
F