From 19dba0668e3d9df0025a5d0cf6e9876f269d9066 Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Mon, 14 Jul 2025 21:45:57 -0400 Subject: [PATCH] chore(interpreter): update docs for slice_mut and slice_range --- .../interpreter/src/interpreter/shared_memory.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/crates/interpreter/src/interpreter/shared_memory.rs b/crates/interpreter/src/interpreter/shared_memory.rs index adecc36288..f7e989393d 100644 --- a/crates/interpreter/src/interpreter/shared_memory.rs +++ b/crates/interpreter/src/interpreter/shared_memory.rs @@ -238,7 +238,13 @@ impl SharedMemory { /// /// # Panics /// - /// Panics on out of bounds. + /// Panics on out of bounds access in debug builds only. + /// + /// # Safety + /// + /// In release builds, calling this method with an out-of-bounds range triggers undefined + /// behavior. Callers must ensure that the range is within the bounds of the memory (i.e., + /// `range.end <= self.len()`). #[inline] #[cfg_attr(debug_assertions, track_caller)] pub fn slice_range(&self, range: Range) -> Ref<'_, [u8]> { @@ -270,7 +276,13 @@ impl SharedMemory { /// /// # Panics /// - /// Panics on out of bounds. + /// Panics on out of bounds access in debug builds only. + /// + /// # Safety + /// + /// In release builds, calling this method with out-of-bounds parameters triggers undefined + /// behavior. Callers must ensure that `offset + size` does not exceed the length of the + /// memory. #[inline] #[cfg_attr(debug_assertions, track_caller)] pub fn slice_mut(&mut self, offset: usize, size: usize) -> RefMut<'_, [u8]> {