From 546d06b541ea82d5fd975946b3b26db9bd97b18c Mon Sep 17 00:00:00 2001 From: Yotam Ofek Date: Tue, 19 Mar 2024 18:26:36 +0200 Subject: [PATCH] Update src/base/storage.rs Co-authored-by: tpdickso --- src/base/storage.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/base/storage.rs b/src/base/storage.rs index fc40bb41..a83e8878 100644 --- a/src/base/storage.rs +++ b/src/base/storage.rs @@ -206,6 +206,14 @@ pub unsafe trait RawStorageMut: RawStorage { /// /// # Safety /// If the indices are out of bounds, the method will cause undefined behavior. + /// + /// # Validity + /// The default implementation of this trait function is only guaranteed to be + /// sound if invocations of `self.ptr_mut()` and `self.get_address_unchecked_linear_mut()` + /// result in stable references. If any of the data pointed to by these trait methods + /// moves as a consequence of invoking either of these methods then this default + /// trait implementation may be invalid or unsound and should be overridden. + #[inline] unsafe fn swap_unchecked_linear(&mut self, i1: usize, i2: usize) { // we can't just use the pointers returned from `get_address_unchecked_linear_mut` because calling a