mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
remove unnecessary frame parameter from after_local_allocated
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
use std::cell::Cell;
|
||||
use std::ptr;
|
||||
use std::{fmt, mem};
|
||||
|
||||
use either::{Either, Left, Right};
|
||||
@@ -278,9 +277,11 @@ pub fn lint_root(&self) -> Option<hir::HirId> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Returns the address of the buffer where the locals are stored. This is used by `Place` as a
|
||||
/// sanity check to detect bugs where we mix up which stack frame a place refers to.
|
||||
#[inline(always)]
|
||||
pub(super) fn locals_addr(&self) -> usize {
|
||||
ptr::addr_of!(self.locals).addr()
|
||||
self.locals.raw.as_ptr().addr()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -508,7 +508,6 @@ fn after_stack_pop(
|
||||
#[inline(always)]
|
||||
fn after_local_allocated(
|
||||
_ecx: &mut InterpCx<'mir, 'tcx, Self>,
|
||||
_frame: usize,
|
||||
_local: mir::Local,
|
||||
_mplace: &MPlaceTy<'tcx, Self::Provenance>,
|
||||
) -> InterpResult<'tcx> {
|
||||
|
||||
@@ -940,7 +940,7 @@ pub fn force_allocation(
|
||||
mplace.mplace,
|
||||
)?;
|
||||
}
|
||||
M::after_local_allocated(self, self.frame_idx(), local, &mplace)?;
|
||||
M::after_local_allocated(self, local, &mplace)?;
|
||||
// Now we can call `access_mut` again, asserting it goes well, and actually
|
||||
// overwrite things. This points to the entire allocation, not just the part
|
||||
// the place refers to, i.e. we do this before we apply `offset`.
|
||||
|
||||
@@ -1473,14 +1473,13 @@ fn after_stack_pop(
|
||||
|
||||
fn after_local_allocated(
|
||||
ecx: &mut InterpCx<'mir, 'tcx, Self>,
|
||||
frame: usize,
|
||||
local: mir::Local,
|
||||
mplace: &MPlaceTy<'tcx, Provenance>,
|
||||
) -> InterpResult<'tcx> {
|
||||
let Some(Provenance::Concrete { alloc_id, .. }) = mplace.ptr().provenance else {
|
||||
panic!("after_local_allocated should only be called on fresh allocations");
|
||||
};
|
||||
let local_decl = &ecx.active_thread_stack()[frame].body.local_decls[local];
|
||||
let local_decl = &ecx.frame().body.local_decls[local];
|
||||
let span = local_decl.source_info.span;
|
||||
ecx.machine.allocation_spans.borrow_mut().insert(alloc_id, (span, None));
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user