/// We infer the borrow_kind with which to borrow upvars in a stack closure. The borrow_kind
/// basically follows a lattice of `imm < unique-imm < mut`, moving from left to right as needed
/// (but never right to left). Here the argument `mutbl` is the borrow_kind that is required by
/// some particular use.
We infer the borrow_kind with which to borrow upvars in a stack closure. The borrow_kind
basically follows a lattice of `imm < unique-imm < mut`, moving from left to right as needed
(but never right to left). Here the argument `mutbl` is the borrow_kind that is required by
some particular use.
We infer the borrow_kind with which to borrow upvars in a stack closure . The borrow_kind basically follows a lattice of ` imm < unique - imm < mut ` moving from left to right as needed ( but never right to left ) . Here the argument ` mutbl ` is the borrow_kind that is required by some particular use .
fn adjust_upvar_borrow_kind(&self,
                                upvar_id: ty::UpvarId,
                                upvar_capture: &mut ty::UpvarCapture,
                                kind: ty::BorrowKind) {
        debug!("adjust_upvar_borrow_kind(upvar_id={:?}, upvar_capture={:?}, kind={:?})",
               upvar_id, upvar_capture, kind);
        match *upvar_capture {
            ty::UpvarCapture::ByValue => {
                // Upvar is already by-value, the strongest criteria.
            }
            ty::UpvarCapture::ByRef(ref mut upvar_borrow) => {
                match (upvar_borrow.kind, kind) {
                    // Take RHS:
                    (ty::ImmBorrow, ty::UniqueImmBorrow) |
                    (ty::ImmBorrow, ty::MutBorrow) |
                    (ty::UniqueImmBorrow, ty::MutBorrow) => {
                        upvar_borrow.kind = kind;
                    }
                    // Take LHS:
                    (ty::ImmBorrow, ty::ImmBorrow) |
                    (ty::UniqueImmBorrow, ty::ImmBorrow) |
                    (ty::UniqueImmBorrow, ty::UniqueImmBorrow) |
                    (ty::MutBorrow, _) => {
                    }
                }
            }
        }
    }
fn adjust_upvar_borrow_kind ( & self , upvar_id : ty :: UpvarId , upvar_capture : & mut ty :: UpvarCapture , kind : ty :: BorrowKind ) { debug ! ( " " upvar_id upvar_capture kind ) ; match * upvar_capture { ty :: UpvarCapture :: ByValue => { // Upvar is already by-value, the strongest criteria. } ty :: UpvarCapture :: ByRef ( ref mut upvar_borrow ) => { match ( upvar_borrow . kind , kind ) { // Take RHS: ( ty :: ImmBorrow , ty :: UniqueImmBorrow ) | ( ty :: ImmBorrow , ty :: MutBorrow ) | ( ty :: UniqueImmBorrow , ty :: MutBorrow ) => { upvar_borrow . kind = kind ; } // Take LHS: ( ty :: ImmBorrow , ty :: ImmBorrow ) | ( ty :: UniqueImmBorrow , ty :: ImmBorrow ) | ( ty :: UniqueImmBorrow , ty :: UniqueImmBorrow ) | ( ty :: MutBorrow , _ ) => { } } } } }
We infer the borrow_kind with which to borrow upvars in a stack closure.
We infer the borrow_kind with which to borrow upvars in a stack closure .
&self
upvar_id
ty::UpvarId
upvar_capture
&mut ty::UpvarCapture
kind
ty::BorrowKind