Skip to content

Commit 10f877b

Browse files
committed
disable overlapping check with Miri (does not work without intptrcast)
1 parent dca61fb commit 10f877b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Diff for: src/libcore/intrinsics.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1333,6 +1333,7 @@ pub(crate) fn is_aligned_and_not_null<T>(ptr: *const T) -> bool {
13331333

13341334
/// Checks whether the regions of memory starting at `src` and `dst` of size
13351335
/// `count * size_of::<T>()` overlap.
1336+
#[cfg(not(miri))] // Cannot compare with `>` across allocations in Miri
13361337
fn overlaps<T>(src: *const T, dst: *const T, count: usize) -> bool {
13371338
let src_usize = src as usize;
13381339
let dst_usize = dst as usize;
@@ -1437,6 +1438,7 @@ pub unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize) {
14371438

14381439
debug_assert!(is_aligned_and_not_null(src), "attempt to copy from unaligned or null pointer");
14391440
debug_assert!(is_aligned_and_not_null(dst), "attempt to copy to unaligned or null pointer");
1441+
#[cfg(not(miri))]
14401442
debug_assert!(!overlaps(src, dst, count), "attempt to copy to overlapping memory");
14411443
copy_nonoverlapping(src, dst, count)
14421444
}

0 commit comments

Comments
 (0)