]> git.lizzy.rs Git - rust.git/commitdiff
move tests that no longer need MIR out of fullmir
authorRalf Jung <post@ralfj.de>
Wed, 11 Jul 2018 19:13:42 +0000 (21:13 +0200)
committerRalf Jung <post@ralfj.de>
Thu, 12 Jul 2018 08:22:23 +0000 (10:22 +0200)
14 files changed:
README.md
tests/compile-fail-fullmir/undefined_byte_read.rs [deleted file]
tests/compile-fail/undefined_byte_read.rs [new file with mode: 0644]
tests/compiletest.rs
tests/run-pass-fullmir/heap.rs [deleted file]
tests/run-pass-fullmir/issue-15080.rs [deleted file]
tests/run-pass-fullmir/move-arg-2-unique.rs [deleted file]
tests/run-pass-fullmir/regions-mock-trans.rs [deleted file]
tests/run-pass-fullmir/vecs.rs [deleted file]
tests/run-pass/heap.rs [new file with mode: 0644]
tests/run-pass/issue-15080.rs [new file with mode: 0644]
tests/run-pass/move-arg-2-unique.rs [new file with mode: 0644]
tests/run-pass/regions-mock-trans.rs [new file with mode: 0644]
tests/run-pass/vecs.rs [new file with mode: 0644]

index 32eca3652945f5d8d8f1a26babf9523b57829aff..38bf1147dab03e813f60960b194c1c7835784202 100644 (file)
--- a/README.md
+++ b/README.md
@@ -70,7 +70,7 @@ RUSTFLAGS='-Zalways-encode-mir' xargo build
 Now you can run miri against the libstd compiled by xargo:
 
 ```sh
-MIRI_SYSROOT=~/.xargo/HOST cargo run --bin miri tests/run-pass-fullmir/vecs.rs
+MIRI_SYSROOT=~/.xargo/HOST cargo run --bin miri tests/run-pass-fullmir/hashmap.rs
 ```
 
 Notice that you will have to re-run the last step of the preparations above when
diff --git a/tests/compile-fail-fullmir/undefined_byte_read.rs b/tests/compile-fail-fullmir/undefined_byte_read.rs
deleted file mode 100644 (file)
index 24718bc..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-// This should fail even without validation
-// compile-flags: -Zmir-emit-validate=0
-
-fn main() {
-    let v: Vec<u8> = Vec::with_capacity(10);
-    let undef = unsafe { *v.get_unchecked(5) };
-    let x = undef + 1; //~ ERROR: error
-    //~^ NOTE attempted to read undefined bytes
-    panic!("this should never print: {}", x);
-}
diff --git a/tests/compile-fail/undefined_byte_read.rs b/tests/compile-fail/undefined_byte_read.rs
new file mode 100644 (file)
index 0000000..24718bc
--- /dev/null
@@ -0,0 +1,10 @@
+// This should fail even without validation
+// compile-flags: -Zmir-emit-validate=0
+
+fn main() {
+    let v: Vec<u8> = Vec::with_capacity(10);
+    let undef = unsafe { *v.get_unchecked(5) };
+    let x = undef + 1; //~ ERROR: error
+    //~^ NOTE attempted to read undefined bytes
+    panic!("this should never print: {}", x);
+}
index 401499f6c5fa744999222de391d30d56190a6660..d5ed02504ab670698c058dc9826f7d6410bb7d04 100644 (file)
@@ -212,5 +212,5 @@ fn compile_fail_miri() {
 
     // FIXME: run tests for other targets, too
     compile_fail(&sysroot, "tests/compile-fail", &host, &host, true);
-    compile_fail(&sysroot, "tests/compile-fail-fullmir", &host, &host, true);
+    //compile_fail(&sysroot, "tests/compile-fail-fullmir", &host, &host, true);
 }
diff --git a/tests/run-pass-fullmir/heap.rs b/tests/run-pass-fullmir/heap.rs
deleted file mode 100644 (file)
index 917d51d..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-//ignore-msvc
-#![feature(box_syntax)]
-
-fn make_box() -> Box<(i16, i16)> {
-    Box::new((1, 2))
-}
-
-fn make_box_syntax() -> Box<(i16, i16)> {
-    box (1, 2)
-}
-
-fn allocate_reallocate() {
-    let mut s = String::new();
-
-    // 6 byte heap alloc (__rust_allocate)
-    s.push_str("foobar");
-    assert_eq!(s.len(), 6);
-    assert_eq!(s.capacity(), 6);
-
-    // heap size doubled to 12 (__rust_reallocate)
-    s.push_str("baz");
-    assert_eq!(s.len(), 9);
-    assert_eq!(s.capacity(), 12);
-
-    // heap size reduced to 9  (__rust_reallocate)
-    s.shrink_to_fit();
-    assert_eq!(s.len(), 9);
-    assert_eq!(s.capacity(), 9);
-}
-
-fn main() {
-    assert_eq!(*make_box(), (1, 2));
-    assert_eq!(*make_box_syntax(), (1, 2));
-    allocate_reallocate();
-}
diff --git a/tests/run-pass-fullmir/issue-15080.rs b/tests/run-pass-fullmir/issue-15080.rs
deleted file mode 100644 (file)
index 4a84f2b..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-//ignore-msvc
-
-#![feature(slice_patterns)]
-
-fn main() {
-    let mut x: &[_] = &[1, 2, 3, 4];
-
-    let mut result = vec!();
-    loop {
-        x = match *x {
-            [1, n, 3, ref rest..] => {
-                result.push(n);
-                rest
-            }
-            [n, ref rest..] => {
-                result.push(n);
-                rest
-            }
-            [] =>
-                break
-        }
-    }
-    assert_eq!(result, [2, 4]);
-}
diff --git a/tests/run-pass-fullmir/move-arg-2-unique.rs b/tests/run-pass-fullmir/move-arg-2-unique.rs
deleted file mode 100644 (file)
index f3c6566..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-//ignore-msvc
-
-#![allow(unused_features, unused_variables)]
-#![feature(box_syntax)]
-
-fn test(foo: Box<Vec<isize>> ) { assert_eq!((*foo)[0], 10); }
-
-pub fn main() {
-    let x = box vec![10];
-    // Test forgetting a local by move-in
-    test(x);
-}
diff --git a/tests/run-pass-fullmir/regions-mock-trans.rs b/tests/run-pass-fullmir/regions-mock-trans.rs
deleted file mode 100644 (file)
index cef62e4..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// FIXME: We handle uninitialzied storage here, which currently makes validation fail.
-// compile-flags: -Zmir-emit-validate=0
-
-//ignore-msvc
-
-#![feature(libc)]
-
-#![allow(dead_code)]
-
-extern crate libc;
-use std::mem;
-
-struct Arena(());
-
-struct Bcx<'a> {
-    fcx: &'a Fcx<'a>
-}
-
-struct Fcx<'a> {
-    arena: &'a Arena,
-    ccx: &'a Ccx
-}
-
-struct Ccx {
-    x: isize
-}
-
-fn alloc<'a>(_bcx : &'a Arena) -> &'a Bcx<'a> {
-    unsafe {
-        mem::transmute(libc::malloc(mem::size_of::<Bcx<'a>>()
-            as libc::size_t))
-    }
-}
-
-fn h<'a>(bcx : &'a Bcx<'a>) -> &'a Bcx<'a> {
-    return alloc(bcx.fcx.arena);
-}
-
-fn g(fcx : &Fcx) {
-    let bcx = Bcx { fcx: fcx };
-    let bcx2 = h(&bcx);
-    unsafe {
-        libc::free(mem::transmute(bcx2));
-    }
-}
-
-fn f(ccx : &Ccx) {
-    let a = Arena(());
-    let fcx = Fcx { arena: &a, ccx: ccx };
-    return g(&fcx);
-}
-
-pub fn main() {
-    let ccx = Ccx { x: 0 };
-    f(&ccx);
-}
diff --git a/tests/run-pass-fullmir/vecs.rs b/tests/run-pass-fullmir/vecs.rs
deleted file mode 100644 (file)
index 9a8912a..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-//ignore-msvc
-
-fn make_vec() -> Vec<u8> {
-    let mut v = Vec::with_capacity(4);
-    v.push(1);
-    v.push(2);
-    v
-}
-
-fn make_vec_macro() -> Vec<u8> {
-    vec![1, 2]
-}
-
-fn make_vec_macro_repeat() -> Vec<u8> {
-    vec![42; 5]
-}
-
-fn make_vec_macro_repeat_zeroed() -> Vec<u8> {
-    vec![0; 7]
-}
-
-fn vec_into_iter() -> u8 {
-    vec![1, 2, 3, 4]
-        .into_iter()
-        .map(|x| x * x)
-        .fold(0, |x, y| x + y)
-}
-
-fn vec_into_iter_zst() -> usize {
-    vec![[0u64; 0], [0u64; 0]]
-        .into_iter()
-        .map(|x| x.len())
-        .sum()
-}
-
-fn vec_reallocate() -> Vec<u8> {
-    let mut v = vec![1, 2];
-    v.push(3);
-    v.push(4);
-    v.push(5);
-    v
-}
-
-fn main() {
-    assert_eq!(vec_reallocate().len(), 5);
-    assert_eq!(vec_into_iter(), 30);
-    assert_eq!(vec_into_iter_zst(), 0);
-    assert_eq!(make_vec().capacity(), 4);
-    assert_eq!(make_vec_macro(), [1, 2]);
-    assert_eq!(make_vec_macro_repeat(), [42; 5]);
-    assert_eq!(make_vec_macro_repeat_zeroed(), [0; 7]);
-}
diff --git a/tests/run-pass/heap.rs b/tests/run-pass/heap.rs
new file mode 100644 (file)
index 0000000..917d51d
--- /dev/null
@@ -0,0 +1,35 @@
+//ignore-msvc
+#![feature(box_syntax)]
+
+fn make_box() -> Box<(i16, i16)> {
+    Box::new((1, 2))
+}
+
+fn make_box_syntax() -> Box<(i16, i16)> {
+    box (1, 2)
+}
+
+fn allocate_reallocate() {
+    let mut s = String::new();
+
+    // 6 byte heap alloc (__rust_allocate)
+    s.push_str("foobar");
+    assert_eq!(s.len(), 6);
+    assert_eq!(s.capacity(), 6);
+
+    // heap size doubled to 12 (__rust_reallocate)
+    s.push_str("baz");
+    assert_eq!(s.len(), 9);
+    assert_eq!(s.capacity(), 12);
+
+    // heap size reduced to 9  (__rust_reallocate)
+    s.shrink_to_fit();
+    assert_eq!(s.len(), 9);
+    assert_eq!(s.capacity(), 9);
+}
+
+fn main() {
+    assert_eq!(*make_box(), (1, 2));
+    assert_eq!(*make_box_syntax(), (1, 2));
+    allocate_reallocate();
+}
diff --git a/tests/run-pass/issue-15080.rs b/tests/run-pass/issue-15080.rs
new file mode 100644 (file)
index 0000000..4a84f2b
--- /dev/null
@@ -0,0 +1,34 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//ignore-msvc
+
+#![feature(slice_patterns)]
+
+fn main() {
+    let mut x: &[_] = &[1, 2, 3, 4];
+
+    let mut result = vec!();
+    loop {
+        x = match *x {
+            [1, n, 3, ref rest..] => {
+                result.push(n);
+                rest
+            }
+            [n, ref rest..] => {
+                result.push(n);
+                rest
+            }
+            [] =>
+                break
+        }
+    }
+    assert_eq!(result, [2, 4]);
+}
diff --git a/tests/run-pass/move-arg-2-unique.rs b/tests/run-pass/move-arg-2-unique.rs
new file mode 100644 (file)
index 0000000..f3c6566
--- /dev/null
@@ -0,0 +1,22 @@
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//ignore-msvc
+
+#![allow(unused_features, unused_variables)]
+#![feature(box_syntax)]
+
+fn test(foo: Box<Vec<isize>> ) { assert_eq!((*foo)[0], 10); }
+
+pub fn main() {
+    let x = box vec![10];
+    // Test forgetting a local by move-in
+    test(x);
+}
diff --git a/tests/run-pass/regions-mock-trans.rs b/tests/run-pass/regions-mock-trans.rs
new file mode 100644 (file)
index 0000000..cef62e4
--- /dev/null
@@ -0,0 +1,66 @@
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// FIXME: We handle uninitialzied storage here, which currently makes validation fail.
+// compile-flags: -Zmir-emit-validate=0
+
+//ignore-msvc
+
+#![feature(libc)]
+
+#![allow(dead_code)]
+
+extern crate libc;
+use std::mem;
+
+struct Arena(());
+
+struct Bcx<'a> {
+    fcx: &'a Fcx<'a>
+}
+
+struct Fcx<'a> {
+    arena: &'a Arena,
+    ccx: &'a Ccx
+}
+
+struct Ccx {
+    x: isize
+}
+
+fn alloc<'a>(_bcx : &'a Arena) -> &'a Bcx<'a> {
+    unsafe {
+        mem::transmute(libc::malloc(mem::size_of::<Bcx<'a>>()
+            as libc::size_t))
+    }
+}
+
+fn h<'a>(bcx : &'a Bcx<'a>) -> &'a Bcx<'a> {
+    return alloc(bcx.fcx.arena);
+}
+
+fn g(fcx : &Fcx) {
+    let bcx = Bcx { fcx: fcx };
+    let bcx2 = h(&bcx);
+    unsafe {
+        libc::free(mem::transmute(bcx2));
+    }
+}
+
+fn f(ccx : &Ccx) {
+    let a = Arena(());
+    let fcx = Fcx { arena: &a, ccx: ccx };
+    return g(&fcx);
+}
+
+pub fn main() {
+    let ccx = Ccx { x: 0 };
+    f(&ccx);
+}
diff --git a/tests/run-pass/vecs.rs b/tests/run-pass/vecs.rs
new file mode 100644 (file)
index 0000000..9a8912a
--- /dev/null
@@ -0,0 +1,52 @@
+//ignore-msvc
+
+fn make_vec() -> Vec<u8> {
+    let mut v = Vec::with_capacity(4);
+    v.push(1);
+    v.push(2);
+    v
+}
+
+fn make_vec_macro() -> Vec<u8> {
+    vec![1, 2]
+}
+
+fn make_vec_macro_repeat() -> Vec<u8> {
+    vec![42; 5]
+}
+
+fn make_vec_macro_repeat_zeroed() -> Vec<u8> {
+    vec![0; 7]
+}
+
+fn vec_into_iter() -> u8 {
+    vec![1, 2, 3, 4]
+        .into_iter()
+        .map(|x| x * x)
+        .fold(0, |x, y| x + y)
+}
+
+fn vec_into_iter_zst() -> usize {
+    vec![[0u64; 0], [0u64; 0]]
+        .into_iter()
+        .map(|x| x.len())
+        .sum()
+}
+
+fn vec_reallocate() -> Vec<u8> {
+    let mut v = vec![1, 2];
+    v.push(3);
+    v.push(4);
+    v.push(5);
+    v
+}
+
+fn main() {
+    assert_eq!(vec_reallocate().len(), 5);
+    assert_eq!(vec_into_iter(), 30);
+    assert_eq!(vec_into_iter_zst(), 0);
+    assert_eq!(make_vec().capacity(), 4);
+    assert_eq!(make_vec_macro(), [1, 2]);
+    assert_eq!(make_vec_macro_repeat(), [42; 5]);
+    assert_eq!(make_vec_macro_repeat_zeroed(), [0; 7]);
+}