about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2019-10-19 15:52:08 +0200
committerRalf Jung <post@ralfj.de>2019-10-19 15:52:08 +0200
commit38fd74f22af7eec30d11d421bcbeaa891c7f7436 (patch)
treebde765235f24cbbecb9c027f3dd2d06bc966338b
parent7f1ce451401b21155923174480f8be9e0b8cf499 (diff)
downloadrust-38fd74f22af7eec30d11d421bcbeaa891c7f7436.tar.gz
rust-38fd74f22af7eec30d11d421bcbeaa891c7f7436.zip
show the proper diagnostics
-rw-r--r--src/test/ui/consts/miri_unleashed/non_const_fn.rs3
-rw-r--r--src/test/ui/consts/miri_unleashed/non_const_fn.stderr16
2 files changed, 17 insertions, 2 deletions
diff --git a/src/test/ui/consts/miri_unleashed/non_const_fn.rs b/src/test/ui/consts/miri_unleashed/non_const_fn.rs
index 01ce6b904e3..e1ac4306575 100644
--- a/src/test/ui/consts/miri_unleashed/non_const_fn.rs
+++ b/src/test/ui/consts/miri_unleashed/non_const_fn.rs
@@ -1,11 +1,12 @@
 // compile-flags: -Zunleash-the-miri-inside-of-you
-#![allow(const_err)]
+#![warn(const_err)]
 
 // A test demonstrating that we prevent calling non-const fn during CTFE.
 
 fn foo() {}
 
 const C: () = foo(); //~ WARN: skipping const checks
+//~^ WARN any use of this value will cause an error
 
 fn main() {
     println!("{:?}", C); //~ ERROR: evaluation of constant expression failed
diff --git a/src/test/ui/consts/miri_unleashed/non_const_fn.stderr b/src/test/ui/consts/miri_unleashed/non_const_fn.stderr
index ad8154bd2c6..7a574b34304 100644
--- a/src/test/ui/consts/miri_unleashed/non_const_fn.stderr
+++ b/src/test/ui/consts/miri_unleashed/non_const_fn.stderr
@@ -4,8 +4,22 @@ warning: skipping const checks
 LL | const C: () = foo();
    |               ^^^^^
 
+warning: any use of this value will cause an error
+  --> $DIR/non_const_fn.rs:8:15
+   |
+LL | const C: () = foo();
+   | --------------^^^^^-
+   |               |
+   |               calling non-const function `foo`
+   |
+note: lint level defined here
+  --> $DIR/non_const_fn.rs:2:9
+   |
+LL | #![warn(const_err)]
+   |         ^^^^^^^^^
+
 error[E0080]: evaluation of constant expression failed
-  --> $DIR/non_const_fn.rs:11:22
+  --> $DIR/non_const_fn.rs:12:22
    |
 LL |     println!("{:?}", C);
    |                      ^ referenced constant has errors