bump for ENABLE_PTR_TRACKING_HOOKS, and remove some dead code
This commit is contained in:
parent
1907782b64
commit
b259512c57
2 changed files with 2 additions and 42 deletions
18
src/lib.rs
18
src/lib.rs
|
|
@ -264,8 +264,10 @@ type MiriEvalContext<'a, 'mir, 'tcx> = EvalContext<'a, 'mir, 'tcx, Evaluator<'tc
|
|||
|
||||
impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for Evaluator<'tcx> {
|
||||
type MemoryKinds = MiriMemoryKind;
|
||||
|
||||
type AllocExtra = stacked_borrows::Stacks;
|
||||
type PointerTag = Borrow;
|
||||
const ENABLE_PTR_TRACKING_HOOKS: bool = true;
|
||||
|
||||
type MemoryMap = MonoHashMap<AllocId, (MemoryKind<MiriMemoryKind>, Allocation<Borrow, Self::AllocExtra>)>;
|
||||
|
||||
|
|
@ -433,22 +435,6 @@ impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for Evaluator<'tcx> {
|
|||
alloc.extra.memory_deallocated(ptr)
|
||||
}
|
||||
|
||||
/*/// Hook for when a reference is cast to a raw pointer
|
||||
#[inline(always)]
|
||||
fn ref_to_raw_cast(
|
||||
ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>,
|
||||
ptr: Pointer<Borrow>,
|
||||
ptr_ty: Ty<'tcx>,
|
||||
size: Size,
|
||||
) -> EvalResult<'tcx> {
|
||||
if !ecx.machine.validate {
|
||||
// No tracking.
|
||||
Ok(())
|
||||
} else {
|
||||
ecx.ref_to_raw_cast(ptr, ptr_ty, size)
|
||||
}
|
||||
}*/
|
||||
|
||||
#[inline(always)]
|
||||
fn tag_reference(
|
||||
ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>,
|
||||
|
|
|
|||
|
|
@ -253,13 +253,6 @@ pub trait EvalContextExt<'tcx> {
|
|||
ptr: Pointer<Borrow>,
|
||||
ptr_ty: Ty<'tcx>,
|
||||
) -> EvalResult<'tcx, Borrow>;
|
||||
|
||||
fn ref_to_raw_cast(
|
||||
&mut self,
|
||||
ptr: Pointer<Borrow>,
|
||||
ptr_ty: Ty<'tcx>,
|
||||
size: Size,
|
||||
) -> EvalResult<'tcx>;
|
||||
}
|
||||
|
||||
impl<'a, 'mir, 'tcx> EvalContextExt<'tcx> for super::MiriEvalContext<'a, 'mir, 'tcx> {
|
||||
|
|
@ -311,23 +304,4 @@ impl<'a, 'mir, 'tcx> EvalContextExt<'tcx> for super::MiriEvalContext<'a, 'mir, '
|
|||
ptr.tag
|
||||
})
|
||||
}
|
||||
|
||||
fn ref_to_raw_cast(
|
||||
&mut self,
|
||||
ptr: Pointer<Borrow>,
|
||||
_ptr_ty: Ty<'tcx>,
|
||||
size: Size,
|
||||
) -> EvalResult<'tcx> {
|
||||
trace!("ref_to_raw_cast: Escaping {:?}", ptr);
|
||||
|
||||
// Make sure this reference is not dangling or so
|
||||
self.memory.check_bounds(ptr, size, false)?;
|
||||
|
||||
// Update the stacks. We cannot use `get_mut` becuse this might be immutable
|
||||
// memory.
|
||||
let alloc = self.memory.get(ptr.alloc_id).expect("We checked that the ptr is fine!");
|
||||
alloc.extra.reborrow(ptr, size, Borrow::Mut(Mut::Raw))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue