Skip to content

Commit efed49b

Browse files
authored
Rollup merge of #71604 - RalfJung:unleash-recursive-zst, r=oli-obk
make recursive-zst test unleashed Make sure we find this issue even without const qualification. r? @oli-obk @ecstatic-morse
2 parents c1c46c7 + 3bce639 commit efed49b

3 files changed

+27
-3
lines changed

src/test/ui/consts/recursive-zst-static.stderr src/test/ui/consts/recursive-zst-static.default.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
error[E0391]: cycle detected when const-evaluating `FOO`
2-
--> $DIR/recursive-zst-static.rs:7:18
2+
--> $DIR/recursive-zst-static.rs:10:18
33
|
44
LL | static FOO: () = FOO;
55
| ^^^
66
|
77
note: ...which requires const-evaluating `FOO`...
8-
--> $DIR/recursive-zst-static.rs:7:1
8+
--> $DIR/recursive-zst-static.rs:10:1
99
|
1010
LL | static FOO: () = FOO;
1111
| ^^^^^^^^^^^^^^^^^^^^^
1212
= note: ...which again requires const-evaluating `FOO`, completing the cycle
1313
note: cycle used when const-evaluating + checking `FOO`
14-
--> $DIR/recursive-zst-static.rs:7:1
14+
--> $DIR/recursive-zst-static.rs:10:1
1515
|
1616
LL | static FOO: () = FOO;
1717
| ^^^^^^^^^^^^^^^^^^^^^

src/test/ui/consts/recursive-zst-static.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// revisions: default unleash
2+
//[unleash]compile-flags: -Zunleash-the-miri-inside-of-you
3+
14
// This test ensures that we do not allow ZST statics to initialize themselves without ever
25
// actually creating a value of that type. This is important, as the ZST may have private fields
36
// that users can reasonably expect to only get initialized by their own code. Thus unsafe code
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
error[E0391]: cycle detected when const-evaluating `FOO`
2+
--> $DIR/recursive-zst-static.rs:10:18
3+
|
4+
LL | static FOO: () = FOO;
5+
| ^^^
6+
|
7+
note: ...which requires const-evaluating `FOO`...
8+
--> $DIR/recursive-zst-static.rs:10:1
9+
|
10+
LL | static FOO: () = FOO;
11+
| ^^^^^^^^^^^^^^^^^^^^^
12+
= note: ...which again requires const-evaluating `FOO`, completing the cycle
13+
note: cycle used when const-evaluating + checking `FOO`
14+
--> $DIR/recursive-zst-static.rs:10:1
15+
|
16+
LL | static FOO: () = FOO;
17+
| ^^^^^^^^^^^^^^^^^^^^^
18+
19+
error: aborting due to previous error
20+
21+
For more information about this error, try `rustc --explain E0391`.

0 commit comments

Comments
 (0)