Skip to content

Commit fb0f72d

Browse files
committed
WIP
1 parent 3fc4180 commit fb0f72d

File tree

3 files changed

+4
-60
lines changed

3 files changed

+4
-60
lines changed

tests/ui/consts/const-eval/stable-metric/ctfe-simple-loop.allow.stderr

-19
This file was deleted.

tests/ui/consts/const-eval/stable-metric/ctfe-simple-loop.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#![cfg_attr(warn, warn(long_running_const_eval))]
44
#![cfg_attr(allow, allow(long_running_const_eval))]
55

6-
// compile-flags: -Z tiny-const-eval-limit
76
const fn simple_loop(n: u32) -> u32 {
87
let mut index = 0;
98
while index < n {
@@ -16,7 +15,7 @@ const fn simple_loop(n: u32) -> u32 {
1615
}
1716

1817
const X: u32 = simple_loop(19);
19-
const Y: u32 = simple_loop(35);
18+
const Y: u32 = simple_loop(3000005);
2019

2120
fn main() {
2221
println!("{X}");
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: constant evaluation is taking a long time
2-
--> $DIR/ctfe-simple-loop.rs:9:5
2+
--> $DIR/ctfe-simple-loop.rs:8:5
33
|
44
LL | / while index < n {
55
LL | |
@@ -14,49 +14,13 @@ LL | | }
1414
help: the constant being evaluated
1515
--> $DIR/ctfe-simple-loop.rs:18:1
1616
|
17-
LL | const X: u32 = simple_loop(19);
17+
LL | const Y: u32 = simple_loop(3000005);
1818
| ^^^^^^^^^^^^
1919
note: the lint level is defined here
2020
--> $DIR/ctfe-simple-loop.rs:3:24
2121
|
2222
LL | #![cfg_attr(warn, warn(long_running_const_eval))]
2323
| ^^^^^^^^^^^^^^^^^^^^^^^
2424

25-
warning: constant evaluation is taking a long time
26-
--> $DIR/ctfe-simple-loop.rs:9:5
27-
|
28-
LL | / while index < n {
29-
LL | |
30-
LL | |
31-
LL | |
32-
LL | | index = index + 1;
33-
LL | | }
34-
| |_____^
35-
|
36-
= note: this lint makes sure the compiler doesn't get stuck due to infinite loops in const eval.
37-
If your compilation actually takes a long time, you can safely allow the lint.
38-
help: the constant being evaluated
39-
--> $DIR/ctfe-simple-loop.rs:19:1
40-
|
41-
LL | const Y: u32 = simple_loop(35);
42-
| ^^^^^^^^^^^^
43-
44-
warning: constant evaluation is taking a long time
45-
--> $DIR/ctfe-simple-loop.rs:9:5
46-
|
47-
LL | / while index < n {
48-
LL | |
49-
LL | |
50-
LL | |
51-
LL | | index = index + 1;
52-
LL | | }
53-
| |_____^ the const evaluator is currently interpreting this expression
54-
|
55-
help: the constant being evaluated
56-
--> $DIR/ctfe-simple-loop.rs:19:1
57-
|
58-
LL | const Y: u32 = simple_loop(35);
59-
| ^^^^^^^^^^^^
60-
61-
warning: 3 warnings emitted
25+
warning: 1 warning emitted
6226

0 commit comments

Comments
 (0)