Skip to content

Commit 15f95b1

Browse files
Cycle errors now occur during const-eval, not checking
1 parent 1343797 commit 15f95b1

File tree

5 files changed

+106
-27
lines changed

5 files changed

+106
-27
lines changed

src/test/ui/issues/issue-17252.stderr

+16-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
1-
error[E0391]: cycle detected when const checking `FOO`
2-
--> $DIR/issue-17252.rs:1:20
1+
error[E0391]: cycle detected when normalizing `FOO`
2+
|
3+
note: ...which requires const-evaluating + checking `FOO`...
4+
--> $DIR/issue-17252.rs:1:1
5+
|
6+
LL | const FOO: usize = FOO;
7+
| ^^^^^^^^^^^^^^^^^^^^^^^
8+
note: ...which requires const-evaluating + checking `FOO`...
9+
--> $DIR/issue-17252.rs:1:1
310
|
411
LL | const FOO: usize = FOO;
5-
| ^^^
12+
| ^^^^^^^^^^^^^^^^^^^^^^^
13+
note: ...which requires const-evaluating `FOO`...
14+
--> $DIR/issue-17252.rs:1:1
615
|
7-
= note: ...which again requires const checking `FOO`, completing the cycle
8-
note: cycle used when const checking `main::{{constant}}#0`
16+
LL | const FOO: usize = FOO;
17+
| ^^^^^^^^^^^^^^^^^^^^^^^
18+
= note: ...which again requires normalizing `FOO`, completing the cycle
19+
note: cycle used when const-evaluating `main::{{constant}}#0`
920
--> $DIR/issue-17252.rs:4:18
1021
|
1122
LL | let _x: [u8; FOO]; // caused stack overflow prior to fix

src/test/ui/issues/issue-23302-1.stderr

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
1-
error[E0391]: cycle detected when const checking `X::A::{{constant}}#0`
1+
error[E0391]: cycle detected when const-evaluating + checking `X::A::{{constant}}#0`
22
--> $DIR/issue-23302-1.rs:4:9
33
|
44
LL | A = X::A as isize,
55
| ^^^^^^^^^^^^^
66
|
7-
= note: ...which again requires const checking `X::A::{{constant}}#0`, completing the cycle
8-
note: cycle used when processing `X::A::{{constant}}#0`
7+
note: ...which requires const-evaluating + checking `X::A::{{constant}}#0`...
98
--> $DIR/issue-23302-1.rs:4:9
109
|
1110
LL | A = X::A as isize,
1211
| ^^^^^^^^^^^^^
12+
note: ...which requires const-evaluating `X::A::{{constant}}#0`...
13+
--> $DIR/issue-23302-1.rs:4:9
14+
|
15+
LL | A = X::A as isize,
16+
| ^^^^^^^^^^^^^
17+
= note: ...which requires normalizing `X::A as isize`...
18+
= note: ...which again requires const-evaluating + checking `X::A::{{constant}}#0`, completing the cycle
19+
note: cycle used when collecting item types in top-level module
20+
--> $DIR/issue-23302-1.rs:3:1
21+
|
22+
LL | enum X {
23+
| ^^^^^^
1324

1425
error: aborting due to previous error
1526

src/test/ui/issues/issue-23302-2.stderr

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
1-
error[E0391]: cycle detected when const checking `Y::A::{{constant}}#0`
1+
error[E0391]: cycle detected when const-evaluating + checking `Y::A::{{constant}}#0`
22
--> $DIR/issue-23302-2.rs:4:9
33
|
44
LL | A = Y::B as isize,
55
| ^^^^^^^^^^^^^
66
|
7-
= note: ...which again requires const checking `Y::A::{{constant}}#0`, completing the cycle
8-
note: cycle used when processing `Y::A::{{constant}}#0`
7+
note: ...which requires const-evaluating + checking `Y::A::{{constant}}#0`...
98
--> $DIR/issue-23302-2.rs:4:9
109
|
1110
LL | A = Y::B as isize,
1211
| ^^^^^^^^^^^^^
12+
note: ...which requires const-evaluating `Y::A::{{constant}}#0`...
13+
--> $DIR/issue-23302-2.rs:4:9
14+
|
15+
LL | A = Y::B as isize,
16+
| ^^^^^^^^^^^^^
17+
= note: ...which requires normalizing `Y::B as isize`...
18+
= note: ...which again requires const-evaluating + checking `Y::A::{{constant}}#0`, completing the cycle
19+
note: cycle used when collecting item types in top-level module
20+
--> $DIR/issue-23302-2.rs:3:1
21+
|
22+
LL | enum Y {
23+
| ^^^^^^
1324

1425
error: aborting due to previous error
1526

src/test/ui/issues/issue-23302-3.stderr

+27-9
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,38 @@
1-
error[E0391]: cycle detected when const checking `A`
2-
--> $DIR/issue-23302-3.rs:1:16
1+
error[E0391]: cycle detected when const-evaluating + checking `A`
2+
--> $DIR/issue-23302-3.rs:1:1
33
|
44
LL | const A: i32 = B;
5-
| ^
5+
| ^^^^^^^^^^^^^^^^^
66
|
7-
note: ...which requires const checking `B`...
8-
--> $DIR/issue-23302-3.rs:3:16
7+
note: ...which requires const-evaluating + checking `A`...
8+
--> $DIR/issue-23302-3.rs:1:1
99
|
10-
LL | const B: i32 = A;
11-
| ^
12-
= note: ...which again requires const checking `A`, completing the cycle
13-
note: cycle used when processing `A`
10+
LL | const A: i32 = B;
11+
| ^^^^^^^^^^^^^^^^^
12+
note: ...which requires const-evaluating `A`...
1413
--> $DIR/issue-23302-3.rs:1:1
1514
|
1615
LL | const A: i32 = B;
1716
| ^^^^^^^^^^^^^^^^^
17+
= note: ...which requires normalizing `B`...
18+
note: ...which requires const-evaluating + checking `B`...
19+
--> $DIR/issue-23302-3.rs:3:1
20+
|
21+
LL | const B: i32 = A;
22+
| ^^^^^^^^^^^^^^^^^
23+
note: ...which requires const-evaluating + checking `B`...
24+
--> $DIR/issue-23302-3.rs:3:1
25+
|
26+
LL | const B: i32 = A;
27+
| ^^^^^^^^^^^^^^^^^
28+
note: ...which requires const-evaluating `B`...
29+
--> $DIR/issue-23302-3.rs:3:1
30+
|
31+
LL | const B: i32 = A;
32+
| ^^^^^^^^^^^^^^^^^
33+
= note: ...which requires normalizing `A`...
34+
= note: ...which again requires const-evaluating + checking `A`, completing the cycle
35+
= note: cycle used when running analysis passes on this crate
1836

1937
error: aborting due to previous error
2038

src/test/ui/issues/issue-36163.stderr

+35-7
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,48 @@
1-
error[E0391]: cycle detected when const checking `Foo::B::{{constant}}#0`
1+
error[E0391]: cycle detected when const-evaluating + checking `Foo::B::{{constant}}#0`
22
--> $DIR/issue-36163.rs:4:9
33
|
44
LL | B = A,
55
| ^
66
|
7-
note: ...which requires const checking `A`...
8-
--> $DIR/issue-36163.rs:1:18
7+
note: ...which requires const-evaluating + checking `Foo::B::{{constant}}#0`...
8+
--> $DIR/issue-36163.rs:4:9
99
|
10-
LL | const A: isize = Foo::B as isize;
11-
| ^^^^^^^^^^^^^^^
12-
= note: ...which again requires const checking `Foo::B::{{constant}}#0`, completing the cycle
13-
note: cycle used when processing `Foo::B::{{constant}}#0`
10+
LL | B = A,
11+
| ^
12+
note: ...which requires const-evaluating `Foo::B::{{constant}}#0`...
1413
--> $DIR/issue-36163.rs:4:9
1514
|
1615
LL | B = A,
1716
| ^
17+
= note: ...which requires normalizing `A`...
18+
note: ...which requires const-evaluating + checking `A`...
19+
--> $DIR/issue-36163.rs:1:1
20+
|
21+
LL | const A: isize = Foo::B as isize;
22+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
23+
note: ...which requires const-evaluating + checking `A`...
24+
--> $DIR/issue-36163.rs:1:1
25+
|
26+
LL | const A: isize = Foo::B as isize;
27+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
28+
note: ...which requires const-evaluating `A`...
29+
--> $DIR/issue-36163.rs:1:1
30+
|
31+
LL | const A: isize = Foo::B as isize;
32+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33+
= note: ...which requires normalizing `A`...
34+
= note: ...which again requires const-evaluating + checking `Foo::B::{{constant}}#0`, completing the cycle
35+
note: cycle used when collecting item types in top-level module
36+
--> $DIR/issue-36163.rs:1:1
37+
|
38+
LL | / const A: isize = Foo::B as isize;
39+
LL | |
40+
LL | | enum Foo {
41+
LL | | B = A,
42+
LL | | }
43+
LL | |
44+
LL | | fn main() {}
45+
| |____________^
1846

1947
error: aborting due to previous error
2048

0 commit comments

Comments
 (0)