mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 19:58:32 +00:00
Add regression test
This commit is contained in:
parent
2ccafed862
commit
fdff100545
@ -0,0 +1,34 @@
|
|||||||
|
error[E0391]: cycle detected when computing type of opaque `f::{opaque#0}`
|
||||||
|
--> $DIR/const_check_false_cycle.rs:9:17
|
||||||
|
|
|
||||||
|
LL | const fn f() -> impl Eq {
|
||||||
|
| ^^^^^^^
|
||||||
|
|
|
||||||
|
note: ...which requires borrow-checking `f`...
|
||||||
|
--> $DIR/const_check_false_cycle.rs:9:1
|
||||||
|
|
|
||||||
|
LL | const fn f() -> impl Eq {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
note: ...which requires promoting constants in MIR for `f`...
|
||||||
|
--> $DIR/const_check_false_cycle.rs:9:1
|
||||||
|
|
|
||||||
|
LL | const fn f() -> impl Eq {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
note: ...which requires const checking `f`...
|
||||||
|
--> $DIR/const_check_false_cycle.rs:9:1
|
||||||
|
|
|
||||||
|
LL | const fn f() -> impl Eq {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
= note: ...which requires computing whether `f::{opaque#0}` is freeze...
|
||||||
|
= note: ...which requires evaluating trait selection obligation `f::{opaque#0}: core::marker::Freeze`...
|
||||||
|
= note: ...which again requires computing type of opaque `f::{opaque#0}`, completing the cycle
|
||||||
|
note: cycle used when computing type of `f::{opaque#0}`
|
||||||
|
--> $DIR/const_check_false_cycle.rs:9:17
|
||||||
|
|
|
||||||
|
LL | const fn f() -> impl Eq {
|
||||||
|
| ^^^^^^^
|
||||||
|
= 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
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0391`.
|
15
tests/ui/impl-trait/rpit/const_check_false_cycle.rs
Normal file
15
tests/ui/impl-trait/rpit/const_check_false_cycle.rs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
//! This test causes a cycle error when checking whether the
|
||||||
|
//! return type is `Freeze` during const checking, even though
|
||||||
|
//! the information is readily available.
|
||||||
|
|
||||||
|
//@ revisions: current next
|
||||||
|
//@[next] compile-flags: -Znext-solver
|
||||||
|
//@[next] check-pass
|
||||||
|
|
||||||
|
const fn f() -> impl Eq {
|
||||||
|
//[current]~^ ERROR cycle detected
|
||||||
|
g()
|
||||||
|
}
|
||||||
|
const fn g() {}
|
||||||
|
|
||||||
|
fn main() {}
|
Loading…
Reference in New Issue
Block a user