Skip to content

Commit 8cf5a26

Browse files
committed
use plain arithmetic instead of ptr::offset API
the offset from the anchor was computed used plain arithmetic so to do the reverse (go from offset to a pointer) also use plain arithmetic we were using the offset API for the reverse operation but miri doesn't like that: it consider the pointer to be out of bounds wrt to the ANCHOR static variable
1 parent aa017a5 commit 8cf5a26

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/pool/cas.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ impl<T> Ptr<T> {
183183
fn as_raw(&self) -> NonNull<T> {
184184
unsafe {
185185
NonNull::new_unchecked(
186-
(anchor::<T>(None) as *mut u8).offset(self.offset() as isize) as *mut T,
186+
(anchor::<T>(None) as isize).wrapping_add(self.offset() as isize) as *mut T,
187187
)
188188
}
189189
}

0 commit comments

Comments
 (0)