Cycle detected when optimizing MIR on nightly

Hi all, we're using nightly rust and as of nightly-2024-08-29 (prior to this it compiled fine) we see the following error:

error[E0391]: cycle detected when optimizing MIR for `crudcomponent::<impl at sdk/couchbase-core/src/crudcomponent.rs:38:1: 44:41>::orchestrate_simple_crud::{closure#0}::{closure#0}::{closure#0}::{closure#1}`
   --> sdk/couchbase-core/src/crudcomponent.rs:156:78
    |
156 |           orchestrate_retries(self.retry_manager.clone(), retry_info, async || {
    |  ______________________________________________________________________________^
157 | |             orchestrate_memd_collection_id(
158 | |                 self.collections.clone(),
159 | |                 scope_name,
...   |
188 | |             .await
189 | |         })
    | |_________^
    |
    = note: ...which immediately requires optimizing MIR for `crudcomponent::<impl at sdk/couchbase-core/src/crudcomponent.rs:38:1: 44:41>::orchestrate_simple_crud::{closure#0}::{closure#0}::{closure#0}::{closure#1}` again
    = note: cycle used when computing layout of `{async closure body@sdk/couchbase-core/src/crudcomponent.rs:156:78: 189:10}`
    = 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

For more information about this error, try `rustc --explain E0391`.
error: could not compile `rscbx_couchbase_core` (lib) due to 1 previous error

Function being flagged can be viewed at couchbase-rs/sdk/couchbase-core/src/crudcomponent.rs at nativex · couchbaselabs/couchbase-rs · GitHub. We're having a bit of a hard time debugging this issue, it's not very clear what this actually means. I've tried looking at the HIR output but it didn't really help and I'm a bit lost on this one as I'm not familiar with MIR. Any help appreciated! (If the answer is: "What are you doing?! That's really not idiomatic rust" then that's also helpful to know).

Would you mind opening an issue for this?

Sure thing, wasn't sure if it was just something obviously wrong that we're doing. Would GitHub - rust-lang/rust: Empowering everyone to build reliable and efficient software. be the correct place for this?

I don't see anything obviously wrong. The async block in question doesn't look like it calls itself or anything like that.

Yes

Marking solved and moving to Cycle detected when optimizing MIR on nightly · Issue #129811 · rust-lang/rust · GitHub

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.