about summary refs log tree commit diff
diff options
context:
space:
mode:
authorKonrad Borowski <konrad@borowski.pw>2019-02-17 12:58:48 +0100
committerKonrad Borowski <konrad@borowski.pw>2019-02-17 12:58:48 +0100
commit3281e621885e45f0b253acb257a22f12d0623fe8 (patch)
tree6b3b39cb79edc3e2ccc80605273d376bc3e0c3c3
parent8af675a07576940ba24e3d91abd10b029b937946 (diff)
downloadrust-3281e621885e45f0b253acb257a22f12d0623fe8.tar.gz
rust-3281e621885e45f0b253acb257a22f12d0623fe8.zip
Remove UB in test_is_null test
-rw-r--r--src/libcore/tests/ptr.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/libcore/tests/ptr.rs b/src/libcore/tests/ptr.rs
index 2c53e4832a8..707519e6734 100644
--- a/src/libcore/tests/ptr.rs
+++ b/src/libcore/tests/ptr.rs
@@ -40,18 +40,17 @@ fn test() {
 }
 
 #[test]
-#[cfg(not(miri))] // This test performs invalid OOB pointer arithmetic
 fn test_is_null() {
     let p: *const isize = null();
     assert!(p.is_null());
 
-    let q = unsafe { p.offset(1) };
+    let q = p.wrapping_offset(1);
     assert!(!q.is_null());
 
     let mp: *mut isize = null_mut();
     assert!(mp.is_null());
 
-    let mq = unsafe { mp.offset(1) };
+    let mq = mp.wrapping_offset(1);
     assert!(!mq.is_null());
 
     // Pointers to unsized types -- slices