]> git.lizzy.rs Git - rust.git/commitdiff
adjust remaining tests
authorRalf Jung <post@ralfj.de>
Fri, 16 Nov 2018 17:38:28 +0000 (18:38 +0100)
committerRalf Jung <post@ralfj.de>
Fri, 16 Nov 2018 21:04:14 +0000 (22:04 +0100)
src/test/compile-fail/const-fn-error.rs
src/test/compile-fail/issue-52443.rs
src/test/ui/issues/issue-39559-2.rs
src/test/ui/issues/issue-39559-2.stderr
src/test/ui/issues/issue-43105.rs
src/test/ui/issues/issue-43105.stderr

index 83f2735aa9d8ee638527801ef583058ad3e29dde..17dc9f94fe19c80c4ed26e877e121b5b34e43c3e 100644 (file)
@@ -19,6 +19,7 @@ const fn f(x: usize) -> usize {
     for i in 0..x {
         //~^ ERROR E0015
         //~| ERROR E0019
+        //~| ERROR E0080
         sum += i;
     }
     sum
index fc42f87ccbfda72e974c5878a08c937d3f78562e..1ed513033fd5d34f34644abd70d560d0fb750d02 100644 (file)
@@ -14,4 +14,5 @@ fn main() {
     [(); {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 evaluation of constant value failed
 }
index 2e480a29774ceb8bb100c04219c72c59e0183aae..f01fd1fd8f1442571c9a7cfa6f9005f647b335a2 100644 (file)
@@ -23,6 +23,8 @@ fn dim() -> usize {
 fn main() {
     let array: [usize; Dim3::dim()]
     //~^ ERROR E0015
+    //~| ERROR E0080
         = [0; Dim3::dim()];
         //~^ ERROR E0015
+        //~| ERROR E0080
 }
index ca9da096b6c16e2139ccd353b1fdfd4a3fb777c9..57e9f23e0b33c311ba0492a00c0a130d74137661 100644 (file)
@@ -4,12 +4,25 @@ error[E0015]: calls in constants are limited to constant functions, tuple struct
 LL |     let array: [usize; Dim3::dim()]
    |                        ^^^^^^^^^^^
 
+error[E0080]: evaluation of constant value failed
+  --> $DIR/issue-39559-2.rs:24:24
+   |
+LL |     let array: [usize; Dim3::dim()]
+   |                        ^^^^^^^^^^^ calling non-const function `<Dim3 as Dim>::dim`
+
 error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
-  --> $DIR/issue-39559-2.rs:26:15
+  --> $DIR/issue-39559-2.rs:27:15
    |
 LL |         = [0; Dim3::dim()];
    |               ^^^^^^^^^^^
 
-error: aborting due to 2 previous errors
+error[E0080]: evaluation of constant value failed
+  --> $DIR/issue-39559-2.rs:27:15
+   |
+LL |         = [0; Dim3::dim()];
+   |               ^^^^^^^^^^^ calling non-const function `<Dim3 as Dim>::dim`
+
+error: aborting due to 4 previous errors
 
-For more information about this error, try `rustc --explain E0015`.
+Some errors occurred: E0015, E0080.
+For more information about an error, try `rustc --explain E0015`.
index 2bddc443d5baf8a564f20b6a6879b4184879dc18..60b18a66f1a384c02b5664356a7182d70849836a 100644 (file)
@@ -12,10 +12,12 @@ fn xyz() -> u8 { 42 }
 
 const NUM: u8 = xyz();
 //~^ ERROR calls in constants are limited to constant functions, tuple structs and tuple variants
+//~| ERROR any use of this value will cause an error [const_err]
 
 fn main() {
     match 1 {
         NUM => unimplemented!(),
+        //~^ ERROR could not evaluate constant pattern
         _ => unimplemented!(),
     }
 }
index 67a6008cd8ebc9dc80e4a7ae4ef8be48914935cf..f26447ed2b9f0a860a9f7d29cbbb2f50c68a54ac 100644 (file)
@@ -4,6 +4,22 @@ error[E0015]: calls in constants are limited to constant functions, tuple struct
 LL | const NUM: u8 = xyz();
    |                 ^^^^^
 
-error: aborting due to previous error
+error: any use of this value will cause an error
+  --> $DIR/issue-43105.rs:13:1
+   |
+LL | const NUM: u8 = xyz();
+   | ^^^^^^^^^^^^^^^^-----^
+   |                 |
+   |                 calling non-const function `xyz`
+   |
+   = note: #[deny(const_err)] on by default
+
+error: could not evaluate constant pattern
+  --> $DIR/issue-43105.rs:19:9
+   |
+LL |         NUM => unimplemented!(),
+   |         ^^^
+
+error: aborting due to 3 previous errors
 
 For more information about this error, try `rustc --explain E0015`.