Skip to content

Commit 6bcb0d6

Browse files
committed
Explain missing error in test
1 parent f98235e commit 6bcb0d6

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/test/ui/consts/const-eval/mod-static-with-const-fn.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ fn foo() {}
2727

2828
static BAR: () = unsafe {
2929
*FOO.0.get() = 5;
30+
// we do not error on the above access, because that is not detectable statically. Instead,
31+
// const evaluation will error when trying to evaluate it. Due to the error below, we never even
32+
// attempt to const evaluate `BAR`, so we don't see the error
3033

3134
foo();
3235
//~^ ERROR calls in statics are limited to constant functions, tuple structs and tuple variants

src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
2-
--> $DIR/mod-static-with-const-fn.rs:31:5
2+
--> $DIR/mod-static-with-const-fn.rs:34:5
33
|
44
LL | foo();
55
| ^^^^^

0 commit comments

Comments
 (0)