]> git.lizzy.rs Git - rust.git/commitdiff
disable overlapping check with Miri (does not work without intptrcast)
authorRalf Jung <post@ralfj.de>
Sat, 20 Jul 2019 15:04:55 +0000 (17:04 +0200)
committerRalf Jung <post@ralfj.de>
Sun, 21 Jul 2019 10:28:06 +0000 (12:28 +0200)
src/libcore/intrinsics.rs

index 56e45c3695f61830594cbaaba62ea3076b27381f..aff36aba01f9e360d2747b19cfaa87d7461695f2 100644 (file)
@@ -1333,6 +1333,7 @@ pub(crate) fn is_aligned_and_not_null<T>(ptr: *const T) -> bool {
 
 /// Checks whether the regions of memory starting at `src` and `dst` of size
 /// `count * size_of::<T>()` overlap.
+#[cfg(not(miri))] // Cannot compare with `>` across allocations in Miri
 fn overlaps<T>(src: *const T, dst: *const T, count: usize) -> bool {
     let src_usize = src as usize;
     let dst_usize = dst as usize;
@@ -1437,6 +1438,7 @@ pub unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize) {
 
     debug_assert!(is_aligned_and_not_null(src), "attempt to copy from unaligned or null pointer");
     debug_assert!(is_aligned_and_not_null(dst), "attempt to copy to unaligned or null pointer");
+    #[cfg(not(miri))]
     debug_assert!(!overlaps(src, dst, count), "attempt to copy to overlapping memory");
     copy_nonoverlapping(src, dst, count)
 }