Skip to content

Commit 7d5f36a

Browse files
committed
A cycle error on a diverging function is now a const stack overflow again
1 parent 2e66f85 commit 7d5f36a

File tree

2 files changed

+91
-16
lines changed

2 files changed

+91
-16
lines changed

src/test/ui/consts/uninhabited-const-issue-61744.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ pub const unsafe fn fake_type<T>() -> T {
55
}
66

77
pub const unsafe fn hint_unreachable() -> ! {
8-
fake_type() //~ ERROR cycle detected when const-evaluating `hint_unreachable` [E0391]
8+
fake_type() //~ ERROR evaluation of constant value failed
99
}
1010

1111
trait Const {
12-
const CONSTANT: i32 = unsafe { fake_type() };
12+
const CONSTANT: i32 = unsafe { fake_type() }; //~ ERROR any use of this value will cause an err
1313
}
1414

15-
impl <T> Const for T {}
15+
impl<T> Const for T {}
1616

1717
pub fn main() -> () {
18-
dbg!(i32::CONSTANT);
18+
dbg!(i32::CONSTANT); //~ ERROR erroneous constant used
1919
}
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,96 @@
1-
error[E0391]: cycle detected when const-evaluating `hint_unreachable`
1+
error[E0080]: evaluation of constant value failed
22
--> $DIR/uninhabited-const-issue-61744.rs:8:5
33
|
4+
LL | hint_unreachable()
5+
| ------------------
6+
| |
7+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
8+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
9+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
10+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
11+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
12+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
13+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
14+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
15+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
16+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
17+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
18+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
19+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
20+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
21+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
22+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
23+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
24+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
25+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
26+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
27+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
28+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
29+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
30+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
31+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
32+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
33+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
34+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
35+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
36+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
37+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
38+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
39+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
40+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
41+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
42+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
43+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
44+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
45+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
46+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
47+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
48+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
49+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
50+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
51+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
52+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
53+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
54+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
55+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
56+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
57+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
58+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
59+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
60+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
61+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
62+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
63+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
64+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
65+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
66+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
67+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
68+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
69+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
70+
| inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5
71+
...
472
LL | fake_type()
573
| ^^^^^^^^^^^
74+
| |
75+
| reached the configured maximum number of stack frames
76+
| inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5
77+
78+
error: any use of this value will cause an error
79+
--> $DIR/uninhabited-const-issue-61744.rs:12:36
680
|
7-
note: ...which requires const-evaluating `fake_type`...
8-
--> $DIR/uninhabited-const-issue-61744.rs:4:5
81+
LL | const CONSTANT: i32 = unsafe { fake_type() };
82+
| -------------------------------^^^^^^^^^^^---
83+
| |
84+
| referenced constant has errors
985
|
10-
LL | hint_unreachable()
11-
| ^^^^^^^^^^^^^^^^^^
12-
= note: ...which again requires const-evaluating `hint_unreachable`, completing the cycle
13-
note: cycle used when const-evaluating `fake_type`
14-
--> $DIR/uninhabited-const-issue-61744.rs:4:5
86+
= note: `#[deny(const_err)]` on by default
87+
88+
error[E0080]: erroneous constant used
89+
--> $DIR/uninhabited-const-issue-61744.rs:18:10
1590
|
16-
LL | hint_unreachable()
17-
| ^^^^^^^^^^^^^^^^^^
91+
LL | dbg!(i32::CONSTANT);
92+
| ^^^^^^^^^^^^^ referenced constant has errors
1893

19-
error: aborting due to previous error
94+
error: aborting due to 3 previous errors
2095

21-
For more information about this error, try `rustc --explain E0391`.
96+
For more information about this error, try `rustc --explain E0080`.

0 commit comments

Comments
 (0)