Skip to content

Commit 869dc35

Browse files
committed
Add regression test
1 parent 43a0686 commit 869dc35

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
error[E0391]: cycle detected when computing type of opaque `f::{opaque#0}`
2+
--> $DIR/const_check_false_cycle.rs:9:17
3+
|
4+
LL | const fn f() -> impl Eq {
5+
| ^^^^^^^
6+
|
7+
note: ...which requires borrow-checking `f`...
8+
--> $DIR/const_check_false_cycle.rs:9:1
9+
|
10+
LL | const fn f() -> impl Eq {
11+
| ^^^^^^^^^^^^^^^^^^^^^^^
12+
note: ...which requires promoting constants in MIR for `f`...
13+
--> $DIR/const_check_false_cycle.rs:9:1
14+
|
15+
LL | const fn f() -> impl Eq {
16+
| ^^^^^^^^^^^^^^^^^^^^^^^
17+
note: ...which requires const checking `f`...
18+
--> $DIR/const_check_false_cycle.rs:9:1
19+
|
20+
LL | const fn f() -> impl Eq {
21+
| ^^^^^^^^^^^^^^^^^^^^^^^
22+
= note: ...which requires computing whether `f::{opaque#0}` is freeze...
23+
= note: ...which requires evaluating trait selection obligation `f::{opaque#0}: core::marker::Freeze`...
24+
= note: ...which again requires computing type of opaque `f::{opaque#0}`, completing the cycle
25+
note: cycle used when computing type of `f::{opaque#0}`
26+
--> $DIR/const_check_false_cycle.rs:9:17
27+
|
28+
LL | const fn f() -> impl Eq {
29+
| ^^^^^^^
30+
= 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
31+
32+
error: aborting due to 1 previous error
33+
34+
For more information about this error, try `rustc --explain E0391`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//! This test causes a cycle error when checking whether the
2+
//! return type is `Freeze` during const checking, even though
3+
//! the information is readily available.
4+
5+
//@ revisions: current next
6+
//@[next] compile-flags: -Znext-solver
7+
//@[next] check-pass
8+
9+
const fn f() -> impl Eq {
10+
//[current]~^ ERROR cycle detected
11+
g()
12+
}
13+
const fn g() {}
14+
15+
fn main() {}

0 commit comments

Comments
 (0)