about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-03-09 18:28:29 +0100
committerRalf Jung <post@ralfj.de>2024-03-10 09:52:29 +0100
commitc3342b41b52aa4f8a4497a696ee783952fca36da (patch)
treea14e6b18e5cebfe79ea8a2bab7150ceab5c8c110 /compiler
parent4497990dff8ce181fa12757eb4e786b85025ae61 (diff)
downloadrust-c3342b41b52aa4f8a4497a696ee783952fca36da.tar.gz
rust-c3342b41b52aa4f8a4497a696ee783952fca36da.zip
remove unnecessary frame parameter from after_local_allocated
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_const_eval/src/interpret/eval_context.rs5
-rw-r--r--compiler/rustc_const_eval/src/interpret/machine.rs1
-rw-r--r--compiler/rustc_const_eval/src/interpret/place.rs2
3 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/eval_context.rs b/compiler/rustc_const_eval/src/interpret/eval_context.rs
index 50e481030a3..7526acf1454 100644
--- a/compiler/rustc_const_eval/src/interpret/eval_context.rs
+++ b/compiler/rustc_const_eval/src/interpret/eval_context.rs
@@ -1,5 +1,4 @@
 use std::cell::Cell;
-use std::ptr;
 use std::{fmt, mem};
 
 use either::{Either, Left, Right};
@@ -278,9 +277,11 @@ impl<'mir, 'tcx, Prov: Provenance, Extra> Frame<'mir, 'tcx, Prov, Extra> {
         })
     }
 
+    /// 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()
     }
 }
 
diff --git a/compiler/rustc_const_eval/src/interpret/machine.rs b/compiler/rustc_const_eval/src/interpret/machine.rs
index 5e6862ad475..04de5162250 100644
--- a/compiler/rustc_const_eval/src/interpret/machine.rs
+++ b/compiler/rustc_const_eval/src/interpret/machine.rs
@@ -508,7 +508,6 @@ pub trait Machine<'mir, 'tcx: 'mir>: Sized {
     #[inline(always)]
     fn after_local_allocated(
         _ecx: &mut InterpCx<'mir, 'tcx, Self>,
-        _frame: usize,
         _local: mir::Local,
         _mplace: &MPlaceTy<'tcx, Self::Provenance>,
     ) -> InterpResult<'tcx> {
diff --git a/compiler/rustc_const_eval/src/interpret/place.rs b/compiler/rustc_const_eval/src/interpret/place.rs
index 90ded6c09db..1a2f1194f89 100644
--- a/compiler/rustc_const_eval/src/interpret/place.rs
+++ b/compiler/rustc_const_eval/src/interpret/place.rs
@@ -940,7 +940,7 @@ where
                                 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`.