]> git.lizzy.rs Git - rust.git/commitdiff
Explain missing error in test
authorOliver Scherer <github35764891676564198441@oli-obk.de>
Tue, 20 Nov 2018 10:13:19 +0000 (11:13 +0100)
committerOliver Scherer <github35764891676564198441@oli-obk.de>
Tue, 20 Nov 2018 10:33:27 +0000 (11:33 +0100)
src/test/ui/consts/const-eval/mod-static-with-const-fn.rs
src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr

index 600931e49a08ed94275ac19592bead56ee379133..01fcc8307c0c11b55ad8b2bda635a018297cf729 100644 (file)
@@ -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
index 899fc24f153a56ea3eb85ee6cb90a2574be19503..01ad1fc9a21b9fac6164b2a5bf06b57e81ddbbae 100644 (file)
@@ -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();
    |     ^^^^^