about summary refs log tree commit diff
path: root/src/test/ui/const-eval
diff options
context:
space:
mode:
authorOliver Schneider <github35764891676564198441@oli-obk.de>2018-06-02 23:38:57 +0200
committerOliver Schneider <github35764891676564198441@oli-obk.de>2018-06-05 20:49:46 +0200
commit5c0d1355f261efd624e0f7755a87e46d954771d3 (patch)
treeb933114434c3ff23dc0e30d29ef10e5badb21028 /src/test/ui/const-eval
parent4a9c58c6bd0e609538053a35685e206f66019820 (diff)
Refactor the const eval diagnostic API
Diffstat (limited to 'src/test/ui/const-eval')
-rw-r--r--src/test/ui/const-eval/conditional_array_execution.rs2
-rw-r--r--src/test/ui/const-eval/conditional_array_execution.stderr6
-rw-r--r--src/test/ui/const-eval/issue-43197.rs4
-rw-r--r--src/test/ui/const-eval/issue-43197.stderr12
-rw-r--r--src/test/ui/const-eval/issue-44578.stderr4
-rw-r--r--src/test/ui/const-eval/promoted_const_fn_fail.rs4
-rw-r--r--src/test/ui/const-eval/promoted_const_fn_fail.stderr15
-rw-r--r--src/test/ui/const-eval/promoted_errors.stderr8
-rw-r--r--src/test/ui/const-eval/pub_const_err.stderr4
-rw-r--r--src/test/ui/const-eval/pub_const_err_bin.stderr4
10 files changed, 31 insertions, 32 deletions
diff --git a/src/test/ui/const-eval/conditional_array_execution.rs b/src/test/ui/const-eval/conditional_array_execution.rs
index 8952a8386d7..daeeae513d9 100644
--- a/src/test/ui/const-eval/conditional_array_execution.rs
+++ b/src/test/ui/const-eval/conditional_array_execution.rs
@@ -19,5 +19,5 @@ const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
 
 fn main() {
     println!("{}", FOO);
-    //~^ WARN constant evaluation error
+    //~^ WARN this expression will panic at runtime
 }
diff --git a/src/test/ui/const-eval/conditional_array_execution.stderr b/src/test/ui/const-eval/conditional_array_execution.stderr
index 5cf73b9fad6..00b39d08eaf 100644
--- a/src/test/ui/const-eval/conditional_array_execution.stderr
+++ b/src/test/ui/const-eval/conditional_array_execution.stderr
@@ -14,9 +14,11 @@ warning: this constant cannot be used
   --> $DIR/conditional_array_execution.rs:16:1
    |
 LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to subtract with overflow
+   | ^^^^^^^^^^^^^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |                   |
+   |                   attempt to subtract with overflow
 
-warning: constant evaluation error
+warning: this expression will panic at runtime
   --> $DIR/conditional_array_execution.rs:21:20
    |
 LL |     println!("{}", FOO);
diff --git a/src/test/ui/const-eval/issue-43197.rs b/src/test/ui/const-eval/issue-43197.rs
index 7ec100e411b..df352adea63 100644
--- a/src/test/ui/const-eval/issue-43197.rs
+++ b/src/test/ui/const-eval/issue-43197.rs
@@ -25,6 +25,6 @@ fn main() {
     //~^ WARN attempt to subtract with overflow
     //~| WARN this constant cannot be used
     println!("{} {}", X, Y);
-    //~^ WARN constant evaluation error
-    //~| WARN constant evaluation error
+    //~^ WARN this expression will panic at runtime
+    //~| WARN this expression will panic at runtime
 }
diff --git a/src/test/ui/const-eval/issue-43197.stderr b/src/test/ui/const-eval/issue-43197.stderr
index d0e13d5657e..412d97883f1 100644
--- a/src/test/ui/const-eval/issue-43197.stderr
+++ b/src/test/ui/const-eval/issue-43197.stderr
@@ -14,7 +14,9 @@ warning: this constant cannot be used
   --> $DIR/issue-43197.rs:21:5
    |
 LL |     const X: u32 = 0-1;
-   |     ^^^^^^^^^^^^^^^^^^^ attempt to subtract with overflow
+   |     ^^^^^^^^^^^^^^^---^
+   |                    |
+   |                    attempt to subtract with overflow
 
 warning: attempt to subtract with overflow
   --> $DIR/issue-43197.rs:24:24
@@ -26,15 +28,17 @@ warning: this constant cannot be used
   --> $DIR/issue-43197.rs:24:5
    |
 LL |     const Y: u32 = foo(0-1);
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^ attempt to subtract with overflow
+   |     ^^^^^^^^^^^^^^^^^^^---^^
+   |                        |
+   |                        attempt to subtract with overflow
 
-warning: constant evaluation error
+warning: this expression will panic at runtime
   --> $DIR/issue-43197.rs:27:23
    |
 LL |     println!("{} {}", X, Y);
    |                       ^ referenced constant has errors
 
-warning: constant evaluation error
+warning: this expression will panic at runtime
   --> $DIR/issue-43197.rs:27:26
    |
 LL |     println!("{} {}", X, Y);
diff --git a/src/test/ui/const-eval/issue-44578.stderr b/src/test/ui/const-eval/issue-44578.stderr
index ce6ff86610a..3632a9baea1 100644
--- a/src/test/ui/const-eval/issue-44578.stderr
+++ b/src/test/ui/const-eval/issue-44578.stderr
@@ -1,4 +1,4 @@
-warning: constant evaluation error
+warning: this expression will panic at runtime
   --> $DIR/issue-44578.rs:36:20
    |
 LL |     println!("{}", <Bar<u16, u8> as Foo>::AMT); //~ WARN const_err
@@ -10,7 +10,7 @@ note: lint level defined here
 LL | #![warn(const_err)]
    |         ^^^^^^^^^
 
-warning: constant evaluation error
+warning: this expression will panic at runtime
   --> $DIR/issue-44578.rs:36:20
    |
 LL |     println!("{}", <Bar<u16, u8> as Foo>::AMT); //~ WARN const_err
diff --git a/src/test/ui/const-eval/promoted_const_fn_fail.rs b/src/test/ui/const-eval/promoted_const_fn_fail.rs
index 5ced2c9dd8f..4888ed6e8dc 100644
--- a/src/test/ui/const-eval/promoted_const_fn_fail.rs
+++ b/src/test/ui/const-eval/promoted_const_fn_fail.rs
@@ -23,8 +23,8 @@ const fn bar() -> u8 {
         // is run on a system whose pointers need more
         // than 8 bits
         Bar { a: &42 }.b as u8
-        //~^ constant evaluation error
-        //~| constant evaluation error
+        //~^ ERROR this expression will panic at runtime
+        //~| ERROR this expression will panic at runtime
     }
 }
 
diff --git a/src/test/ui/const-eval/promoted_const_fn_fail.stderr b/src/test/ui/const-eval/promoted_const_fn_fail.stderr
index f910705bb7b..d805e1a27c9 100644
--- a/src/test/ui/const-eval/promoted_const_fn_fail.stderr
+++ b/src/test/ui/const-eval/promoted_const_fn_fail.stderr
@@ -1,4 +1,4 @@
-error: constant evaluation error
+error: this expression will panic at runtime
   --> $DIR/promoted_const_fn_fail.rs:25:9
    |
 LL |         Bar { a: &42 }.b as u8
@@ -9,23 +9,12 @@ note: lint level defined here
    |
 LL | #![deny(const_err)]
    |         ^^^^^^^^^
-note: inside call to `bar`
-  --> $DIR/promoted_const_fn_fail.rs:35:28
-   |
-LL |     let x: &'static u8 = &(bar() + 1);
-   |                            ^^^^^
 
-error: constant evaluation error
+error: this expression will panic at runtime
   --> $DIR/promoted_const_fn_fail.rs:25:9
    |
 LL |         Bar { a: &42 }.b as u8
    |         ^^^^^^^^^^^^^^^^^^^^^^ a raw memory access tried to access part of a pointer value as raw bytes
-   |
-note: inside call to `bar`
-  --> $DIR/promoted_const_fn_fail.rs:35:28
-   |
-LL |     let x: &'static u8 = &(bar() + 1);
-   |                            ^^^^^
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/const-eval/promoted_errors.stderr b/src/test/ui/const-eval/promoted_errors.stderr
index 683ee5375fb..a4c1c48a03d 100644
--- a/src/test/ui/const-eval/promoted_errors.stderr
+++ b/src/test/ui/const-eval/promoted_errors.stderr
@@ -1,4 +1,4 @@
-warning: constant evaluation error
+warning: this expression will panic at runtime
   --> $DIR/promoted_errors.rs:17:14
    |
 LL |     let _x = 0u32 - 1;
@@ -16,7 +16,7 @@ warning: attempt to divide by zero
 LL |     println!("{}", 1/(1-1));
    |                    ^^^^^^^
 
-warning: constant evaluation error
+warning: this expression will panic at runtime
   --> $DIR/promoted_errors.rs:19:20
    |
 LL |     println!("{}", 1/(1-1));
@@ -28,13 +28,13 @@ warning: attempt to divide by zero
 LL |     let _x = 1/(1-1);
    |              ^^^^^^^
 
-warning: constant evaluation error
+warning: this expression will panic at runtime
   --> $DIR/promoted_errors.rs:22:14
    |
 LL |     let _x = 1/(1-1);
    |              ^^^^^^^ attempt to divide by zero
 
-warning: constant evaluation error
+warning: this expression will panic at runtime
   --> $DIR/promoted_errors.rs:25:20
    |
 LL |     println!("{}", 1/(false as u32));
diff --git a/src/test/ui/const-eval/pub_const_err.stderr b/src/test/ui/const-eval/pub_const_err.stderr
index 068825f1cd3..35228941754 100644
--- a/src/test/ui/const-eval/pub_const_err.stderr
+++ b/src/test/ui/const-eval/pub_const_err.stderr
@@ -14,7 +14,9 @@ warning: this constant cannot be used
   --> $DIR/pub_const_err.rs:16:1
    |
 LL | pub const Z: u32 = 0 - 1;
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to subtract with overflow
+   | ^^^^^^^^^^^^^^^^^^^-----^
+   |                    |
+   |                    attempt to subtract with overflow
 
 warning: attempt to subtract with overflow
   --> $DIR/pub_const_err.rs:20:22
diff --git a/src/test/ui/const-eval/pub_const_err_bin.stderr b/src/test/ui/const-eval/pub_const_err_bin.stderr
index dcb8125fc55..a6db2176011 100644
--- a/src/test/ui/const-eval/pub_const_err_bin.stderr
+++ b/src/test/ui/const-eval/pub_const_err_bin.stderr
@@ -14,7 +14,9 @@ warning: this constant cannot be used
   --> $DIR/pub_const_err_bin.rs:14:1
    |
 LL | pub const Z: u32 = 0 - 1;
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to subtract with overflow
+   | ^^^^^^^^^^^^^^^^^^^-----^
+   |                    |
+   |                    attempt to subtract with overflow
 
 warning: attempt to subtract with overflow
   --> $DIR/pub_const_err_bin.rs:18:22