about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Scherer <github35764891676564198441@oli-obk.de>2018-11-20 11:13:19 +0100
committerOliver Scherer <github35764891676564198441@oli-obk.de>2018-11-20 11:33:27 +0100
commit6bcb0d6152e0b817da7af23bdb2abf13a8b2db43 (patch)
treecb83b77c34cb0b4806d67ccbfbe600a2facdee81
parentf98235ed9d8be7a6966764384a99e18ead1195e2 (diff)
downloadrust-6bcb0d6152e0b817da7af23bdb2abf13a8b2db43.tar.gz
rust-6bcb0d6152e0b817da7af23bdb2abf13a8b2db43.zip
Explain missing error in test
-rw-r--r--src/test/ui/consts/const-eval/mod-static-with-const-fn.rs3
-rw-r--r--src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr2
2 files changed, 4 insertions, 1 deletions
diff --git a/src/test/ui/consts/const-eval/mod-static-with-const-fn.rs b/src/test/ui/consts/const-eval/mod-static-with-const-fn.rs
index 600931e49a0..01fcc8307c0 100644
--- a/src/test/ui/consts/const-eval/mod-static-with-const-fn.rs
+++ b/src/test/ui/consts/const-eval/mod-static-with-const-fn.rs
@@ -27,6 +27,9 @@ fn foo() {}
 
 static BAR: () = unsafe {
     *FOO.0.get() = 5;
+    // we do not error on the above access, because that is not detectable statically. Instead,
+    // const evaluation will error when trying to evaluate it. Due to the error below, we never even
+    // attempt to const evaluate `BAR`, so we don't see the error
 
     foo();
     //~^ ERROR calls in statics are limited to constant functions, tuple structs and tuple variants
diff --git a/src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr b/src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr
index 899fc24f153..01ad1fc9a21 100644
--- a/src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr
+++ b/src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr
@@ -1,5 +1,5 @@
 error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
-  --> $DIR/mod-static-with-const-fn.rs:31:5
+  --> $DIR/mod-static-with-const-fn.rs:34:5
    |
 LL |     foo();
    |     ^^^^^