fn dealloc(
        &mut self,
        tag: SbTag,
        dbg_ptr: Pointer<AllocId>, // just for debug printing and error messages
        global: &GlobalState,
    ) -> InterpResult<'tcx> {
        // Step 1: Find granting item.
        self.find_granting(AccessKind::Write, tag).ok_or_else(|| {
            err_sb_ub(format!(
                "no item granting write access for deallocation to tag {:?} at {:?} found in borrow stack",
                tag, dbg_ptr,
            ), None)
        })?;

        // Step 2: Remove all items.  Also checks for protectors.
        for item in self.borrows.drain(..).rev() {
            Stack::check_protector(&item, None, global)?;
        }

        Ok(())
    }
/// Deallocate a location: Like a write access, but also there must be no
/// active protectors at all because we will remove all items.
Deallocate a location: Like a write access, but also there must be no
active protectors at all because we will remove all items.
Deallocate a location : Like a write access but also there must be no active protectors at all because we will remove all items .
fn dealloc(
        &mut self,
        tag: SbTag,
        dbg_ptr: Pointer<AllocId>, // just for debug printing and error messages
        global: &GlobalState,
    ) -> InterpResult<'tcx> {
        // Step 1: Find granting item.
        self.find_granting(AccessKind::Write, tag).ok_or_else(|| {
            err_sb_ub(format!(
                "no item granting write access for deallocation to tag {:?} at {:?} found in borrow stack",
                tag, dbg_ptr,
            ), None)
        })?;
        // Step 2: Remove all items.  Also checks for protectors.
        for item in self.borrows.drain(..).rev() {
            Stack::check_protector(&item, None, global)?;
        }
        Ok(())
    }
fn dealloc ( & mut self , tag : SbTag , dbg_ptr : Pointer < AllocId > , // just for debug printing and error messages global : & GlobalState , ) -> InterpResult < ' tcx > { // Step 1: Find granting item. self . find_granting ( AccessKind :: Write , tag ) . ok_or_else ( | | { err_sb_ub ( format ! ( " " tag dbg_ptr ) , None ) } ) ? ; // Step 2: Remove all items.  Also checks for protectors. for item in self . borrows . drain ( .. ) . rev ( ) { Stack :: check_protector ( & item , None , global ) ? ; } Ok ( ( ) ) }
Deallocate a location: Like a write access, but also there must be no
active protectors at all because we will remove all items.
Deallocate a location : Like a write access but also there must be no active protectors at all because we will remove all items .
&mut self
tag
SbTag
dbg_ptr
Pointer<AllocId>
global
&GlobalState