Closed
Description
#![crate_type = "lib"]
#[derive(Clone, Debug)]
pub struct S {}
impl S {
pub async fn g(mut c: Self) {
Self::h(&mut c);
}
pub fn h(c: &mut Self) {
let _ = S::g(c.clone());
}
}
$ rustc --edition=2018 -Zmir-opt-level=2 a.rs
error[E0391]: cycle detected when optimizing MIR for `<impl at a.rs:6:1: 14:2>::g::{{closure}}#0`
--> a.rs:7:33
|
7 | pub async fn g(mut c: Self) {
| _________________________________^
8 | | Self::h(&mut c);
9 | | }
| |_____^
|
note: ...which requires optimizing MIR for `<impl at a.rs:6:1: 14:2>::h`...
--> a.rs:11:5
|
11 | pub fn h(c: &mut Self) {
| ^^^^^^^^^^^^^^^^^^^^^^
= note: ...which requires computing layout of `std::future::from_generator::GenFuture<[static [email protected]:7:33: 9:6 __arg0:S {}]>`...
= note: ...which requires computing layout of `[static [email protected]:7:33: 9:6 __arg0:S {}]`...
= note: ...which again requires optimizing MIR for `<impl at a.rs:6:1: 14:2>::g::{{closure}}#0`, completing the cycle