]> git.lizzy.rs Git - rust.git/commitdiff
disable some compile-fail tests for rustc
authorRalf Jung <post@ralfj.de>
Sat, 20 Jul 2019 20:38:41 +0000 (22:38 +0200)
committerRalf Jung <post@ralfj.de>
Sat, 20 Jul 2019 20:38:41 +0000 (22:38 +0200)
tests/compile-fail-norustc/copy_nonoverlapping.rs [new file with mode: 0644]
tests/compile-fail-norustc/copy_null.rs [new file with mode: 0644]
tests/compile-fail-norustc/copy_unaligned.rs [new file with mode: 0644]
tests/compile-fail/copy_nonoverlapping.rs [deleted file]
tests/compile-fail/copy_null.rs [deleted file]
tests/compile-fail/copy_unaligned.rs [deleted file]
tests/compiletest.rs

diff --git a/tests/compile-fail-norustc/copy_nonoverlapping.rs b/tests/compile-fail-norustc/copy_nonoverlapping.rs
new file mode 100644 (file)
index 0000000..748bccf
--- /dev/null
@@ -0,0 +1,12 @@
+#![feature(core_intrinsics)]
+
+//error-pattern: copy_nonoverlapping called on overlapping ranges
+
+fn main() {
+    let mut data = [0u8; 16];
+    unsafe {
+        let a = data.as_mut_ptr();
+        let b = a.wrapping_offset(1) as *mut _;
+        std::ptr::copy_nonoverlapping(a, b, 2);
+    }
+}
diff --git a/tests/compile-fail-norustc/copy_null.rs b/tests/compile-fail-norustc/copy_null.rs
new file mode 100644 (file)
index 0000000..08391b1
--- /dev/null
@@ -0,0 +1,8 @@
+//error-pattern: invalid use of NULL pointer
+
+fn main() {
+    let mut data = [0u16; 4];
+    let ptr = &mut data[0] as *mut u16;
+    // Even copying 0 elements from NULL should error.
+    unsafe { ptr.copy_from(std::ptr::null(), 0); }
+}
diff --git a/tests/compile-fail-norustc/copy_unaligned.rs b/tests/compile-fail-norustc/copy_unaligned.rs
new file mode 100644 (file)
index 0000000..e1f2432
--- /dev/null
@@ -0,0 +1,8 @@
+//error-pattern: tried to access memory with alignment 1, but alignment 2 is required
+
+fn main() {
+    let mut data = [0u16; 8];
+    let ptr = (&mut data[0] as *mut u16 as *mut u8).wrapping_add(1) as *mut u16;
+    // Even copying 0 elements to something unaligned should error
+    unsafe { ptr.copy_from(&data[5], 0); }
+}
diff --git a/tests/compile-fail/copy_nonoverlapping.rs b/tests/compile-fail/copy_nonoverlapping.rs
deleted file mode 100644 (file)
index 748bccf..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#![feature(core_intrinsics)]
-
-//error-pattern: copy_nonoverlapping called on overlapping ranges
-
-fn main() {
-    let mut data = [0u8; 16];
-    unsafe {
-        let a = data.as_mut_ptr();
-        let b = a.wrapping_offset(1) as *mut _;
-        std::ptr::copy_nonoverlapping(a, b, 2);
-    }
-}
diff --git a/tests/compile-fail/copy_null.rs b/tests/compile-fail/copy_null.rs
deleted file mode 100644 (file)
index 08391b1..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-//error-pattern: invalid use of NULL pointer
-
-fn main() {
-    let mut data = [0u16; 4];
-    let ptr = &mut data[0] as *mut u16;
-    // Even copying 0 elements from NULL should error.
-    unsafe { ptr.copy_from(std::ptr::null(), 0); }
-}
diff --git a/tests/compile-fail/copy_unaligned.rs b/tests/compile-fail/copy_unaligned.rs
deleted file mode 100644 (file)
index e1f2432..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-//error-pattern: tried to access memory with alignment 1, but alignment 2 is required
-
-fn main() {
-    let mut data = [0u16; 8];
-    let ptr = (&mut data[0] as *mut u16 as *mut u8).wrapping_add(1) as *mut u16;
-    // Even copying 0 elements to something unaligned should error
-    unsafe { ptr.copy_from(&data[5], 0); }
-}
index 302c080a52eb696a4055e4548c466f55f2de17ab..16311d0749b3dfb2040d737e0c70648628fdaf5a 100644 (file)
@@ -112,6 +112,13 @@ fn run_pass_miri(opt: bool) {
 
 fn compile_fail_miri(opt: bool) {
     compile_fail("tests/compile-fail", &get_target(), opt);
+    if rustc_test_suite().is_none() {
+        // FIXME: Some tests disabled in rustc test suite because
+        // they run with a debug-assertion libstd which changes the errors.
+        // We should build our own libstd for testing, see
+        // <https://github.com/rust-lang/rust/issues/61833>.
+        compile_fail("tests/compile-fail-norustc", &get_target(), opt);
+    }
 }
 
 fn test_runner(_tests: &[&()]) {