]> git.lizzy.rs Git - rust.git/commitdiff
Move platform dependent output ui tests to compile-fail
authorOliver Schneider <github35764891676564198441@oli-obk.de>
Wed, 3 Oct 2018 09:46:05 +0000 (11:46 +0200)
committerOliver Schneider <github35764891676564198441@oli-obk.de>
Wed, 3 Oct 2018 09:46:05 +0000 (11:46 +0200)
src/test/compile-fail/const-fn-error.rs [new file with mode: 0644]
src/test/compile-fail/issue-52443.rs [new file with mode: 0644]
src/test/ui/consts/const-eval/issue-52443.rs [deleted file]
src/test/ui/consts/const-eval/issue-52443.stderr [deleted file]
src/test/ui/consts/const-fn-error.rs [deleted file]
src/test/ui/consts/const-fn-error.stderr [deleted file]

diff --git a/src/test/compile-fail/const-fn-error.rs b/src/test/compile-fail/const-fn-error.rs
new file mode 100644 (file)
index 0000000..6eda417
--- /dev/null
@@ -0,0 +1,30 @@
+// Copyright 2015 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.
+
+#![feature(const_fn)]
+
+const X : usize = 2;
+
+const fn f(x: usize) -> usize {
+    let mut sum = 0;
+    //~^ let bindings in constant functions are unstable
+    //~| statements in constant functions are unstable
+    for i in 0..x {
+        //~^ ERROR E0015
+        //~| ERROR E0019
+        sum += i;
+    }
+    sum
+}
+
+#[allow(unused_variables)]
+fn main() {
+    let a : [i32; f(X)]; //~ ERROR E0080
+}
diff --git a/src/test/compile-fail/issue-52443.rs b/src/test/compile-fail/issue-52443.rs
new file mode 100644 (file)
index 0000000..2ae94f6
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2018 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.
+
+fn main() {
+    [(); & { loop { continue } } ]; //~ ERROR mismatched types
+    [(); loop { break }]; //~ ERROR mismatched types
+    [(); {while true {break}; 0}]; //~ ERROR constant contains unimplemented expression type
+    [(); { for _ in 0usize.. {}; 0}]; //~ ERROR calls in constants are limited to constant functions
+    //~^ ERROR constant contains unimplemented expression type
+    //~| ERROR could not evaluate repeat length
+}
diff --git a/src/test/ui/consts/const-eval/issue-52443.rs b/src/test/ui/consts/const-eval/issue-52443.rs
deleted file mode 100644 (file)
index 2ae94f6..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2018 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.
-
-fn main() {
-    [(); & { loop { continue } } ]; //~ ERROR mismatched types
-    [(); loop { break }]; //~ ERROR mismatched types
-    [(); {while true {break}; 0}]; //~ ERROR constant contains unimplemented expression type
-    [(); { for _ in 0usize.. {}; 0}]; //~ ERROR calls in constants are limited to constant functions
-    //~^ ERROR constant contains unimplemented expression type
-    //~| ERROR could not evaluate repeat length
-}
diff --git a/src/test/ui/consts/const-eval/issue-52443.stderr b/src/test/ui/consts/const-eval/issue-52443.stderr
deleted file mode 100644 (file)
index 8c6beda..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/issue-52443.rs:12:10
-   |
-LL |     [(); & { loop { continue } } ]; //~ ERROR mismatched types
-   |          ^^^^^^^^^^^^^^^^^^^^^^^
-   |          |
-   |          expected usize, found reference
-   |          help: consider removing the borrow: `{ loop { continue } }`
-   |
-   = note: expected type `usize`
-              found type `&_`
-
-error[E0308]: mismatched types
-  --> $DIR/issue-52443.rs:13:17
-   |
-LL |     [(); loop { break }]; //~ ERROR mismatched types
-   |                 ^^^^^ expected (), found usize
-   |
-   = note: expected type `()`
-              found type `usize`
-
-error[E0019]: constant contains unimplemented expression type
-  --> $DIR/issue-52443.rs:14:11
-   |
-LL |     [(); {while true {break}; 0}]; //~ ERROR constant contains unimplemented expression type
-   |           ^^^^^^^^^^^^^^^^^^
-
-error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
-  --> $DIR/issue-52443.rs:15:21
-   |
-LL |     [(); { for _ in 0usize.. {}; 0}]; //~ ERROR calls in constants are limited to constant functions
-   |                     ^^^^^^^^
-
-error[E0019]: constant contains unimplemented expression type
-  --> $DIR/issue-52443.rs:15:21
-   |
-LL |     [(); { for _ in 0usize.. {}; 0}]; //~ ERROR calls in constants are limited to constant functions
-   |                     ^^^^^^^^
-
-error[E0080]: could not evaluate repeat length
-  --> $DIR/issue-52443.rs:15:10
-   |
-LL |     [(); { for _ in 0usize.. {}; 0}]; //~ ERROR calls in constants are limited to constant functions
-   |          ^^^^^^^^^^^--------^^^^^^^
-   |                     |
-   |                     inside call to `std::iter::range::<impl std::iter::Iterator for std::ops::RangeFrom<A>><usize>::next`
-   | 
-  ::: $SRC_DIR/libcore/ptr.rs:LL:COL
-   |
-LL |         let z = read(x);
-   |                 ------- inside call to `std::ptr::read::<usize>`
-...
-LL |     let mut tmp: T = mem::uninitialized();
-   |                      -------------------- inside call to `std::mem::uninitialized::<usize>`
-   | 
-  ::: $SRC_DIR/libcore/iter/range.rs:LL:COL
-   |
-LL |         mem::swap(&mut n, &mut self.start);
-   |         ---------------------------------- inside call to `std::mem::swap::<usize>`
-   | 
-  ::: $SRC_DIR/libcore/mem.rs:LL:COL
-   |
-LL |     intrinsics::uninit()
-   |     -------------------- "calling intrinsic `uninit`" needs an rfc before being allowed inside constants
-...
-LL |         ptr::swap_nonoverlapping_one(x, y);
-   |         ---------------------------------- inside call to `std::ptr::swap_nonoverlapping_one::<usize>`
-
-error: aborting due to 6 previous errors
-
-Some errors occurred: E0015, E0019, E0080, E0308.
-For more information about an error, try `rustc --explain E0015`.
diff --git a/src/test/ui/consts/const-fn-error.rs b/src/test/ui/consts/const-fn-error.rs
deleted file mode 100644 (file)
index 6eda417..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2015 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.
-
-#![feature(const_fn)]
-
-const X : usize = 2;
-
-const fn f(x: usize) -> usize {
-    let mut sum = 0;
-    //~^ let bindings in constant functions are unstable
-    //~| statements in constant functions are unstable
-    for i in 0..x {
-        //~^ ERROR E0015
-        //~| ERROR E0019
-        sum += i;
-    }
-    sum
-}
-
-#[allow(unused_variables)]
-fn main() {
-    let a : [i32; f(X)]; //~ ERROR E0080
-}
diff --git a/src/test/ui/consts/const-fn-error.stderr b/src/test/ui/consts/const-fn-error.stderr
deleted file mode 100644 (file)
index 439493a..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-error[E0658]: let bindings in constant functions are unstable (see issue #48821)
-  --> $DIR/const-fn-error.rs:16:19
-   |
-LL |     let mut sum = 0;
-   |                   ^
-   |
-   = help: add #![feature(const_let)] to the crate attributes to enable
-
-error[E0658]: statements in constant functions are unstable (see issue #48821)
-  --> $DIR/const-fn-error.rs:16:19
-   |
-LL |     let mut sum = 0;
-   |                   ^
-   |
-   = help: add #![feature(const_let)] to the crate attributes to enable
-
-error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-  --> $DIR/const-fn-error.rs:19:14
-   |
-LL |     for i in 0..x {
-   |              ^^^^
-
-error[E0019]: constant function contains unimplemented expression type
-  --> $DIR/const-fn-error.rs:19:14
-   |
-LL |     for i in 0..x {
-   |              ^^^^
-
-error[E0080]: could not evaluate constant expression
-  --> $DIR/const-fn-error.rs:29:13
-   |
-LL |     for i in 0..x {
-   |              ---- inside call to `std::iter::range::<impl std::iter::Iterator for std::ops::Range<A>><usize>::next`
-...
-LL |     let a : [i32; f(X)]; //~ ERROR E0080
-   |             ^^^^^^----^
-   |                   |
-   |                   inside call to `f`
-   | 
-  ::: $SRC_DIR/libcore/ptr.rs:LL:COL
-   |
-LL |         let z = read(x);
-   |                 ------- inside call to `std::ptr::read::<usize>`
-...
-LL |     let mut tmp: T = mem::uninitialized();
-   |                      -------------------- inside call to `std::mem::uninitialized::<usize>`
-   | 
-  ::: $SRC_DIR/libcore/iter/range.rs:LL:COL
-   |
-LL |                 mem::swap(&mut n, &mut self.start);
-   |                 ---------------------------------- inside call to `std::mem::swap::<usize>`
-   | 
-  ::: $SRC_DIR/libcore/mem.rs:LL:COL
-   |
-LL |     intrinsics::uninit()
-   |     -------------------- "calling intrinsic `uninit`" needs an rfc before being allowed inside constants
-...
-LL |         ptr::swap_nonoverlapping_one(x, y);
-   |         ---------------------------------- inside call to `std::ptr::swap_nonoverlapping_one::<usize>`
-
-error: aborting due to 5 previous errors
-
-Some errors occurred: E0015, E0019, E0080, E0658.
-For more information about an error, try `rustc --explain E0015`.