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 600931e49a08..01fcc8307c0c 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 899fc24f153a..01ad1fc9a21b 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(); | ^^^^^