Skip to content

Commit 9e783e2

Browse files
committed
Add regression test
1 parent bc0170a commit 9e783e2

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//@ compile-flags: -Z threads=2
2+
//@ check-fail
3+
4+
const FOO: usize = FOO; //~ERROR `main` function not found in crate `cycle_crash
5+
//~^ cycle detected when simplifying constant for the type system `FOO`
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
error[E0601]: `main` function not found in crate `cycle_crash`
2+
--> $DIR/cycle_crash.rs:4:24
3+
|
4+
LL | const FOO: usize = FOO;
5+
| ^ consider adding a `main` function to `$DIR/cycle_crash.rs`
6+
7+
error[E0391]: cycle detected when simplifying constant for the type system `FOO`
8+
--> $DIR/cycle_crash.rs:4:1
9+
|
10+
LL | const FOO: usize = FOO;
11+
| ^^^^^^^^^^^^^^^^
12+
|
13+
note: ...which requires const-evaluating + checking `FOO`...
14+
--> $DIR/cycle_crash.rs:4:20
15+
|
16+
LL | const FOO: usize = FOO;
17+
| ^^^
18+
= note: ...which again requires simplifying constant for the type system `FOO`, completing the cycle
19+
= note: cycle used when running analysis passes on this crate
20+
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
21+
22+
error: aborting due to 2 previous errors
23+
24+
Some errors have detailed explanations: E0391, E0601.
25+
For more information about an error, try `rustc --explain E0391`.

0 commit comments

Comments
 (0)