Skip to content

Commit e55d738

Browse files
committed
Add regression test
1 parent e3291ea commit e55d738

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

Diff for: tests/ui/impl-trait/rpit/const_check_false_cycle.rs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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+
const fn f() -> impl Eq {
6+
//~^ ERROR cycle detected
7+
g()
8+
}
9+
const fn g() {}
10+
11+
fn main() {}
+34
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:5: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:5: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:5:1
14+
|
15+
LL | const fn f() -> impl Eq {
16+
| ^^^^^^^^^^^^^^^^^^^^^^^
17+
note: ...which requires const checking `f`...
18+
--> $DIR/const_check_false_cycle.rs:5: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:5: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`.

0 commit comments

Comments
 (0)