Skip to content

Cycle detected when optimizing MIR on nightly #129811

Closed
@chvck

Description

@chvck

Originally posted at https://users.rust-lang.org/t/cycle-detected-when-optimizing-mir-on-nightly/116849/1 and filing this upon request from @bjorn3 .

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.

I expected to see this happen: Compilation succeed.

Instead, this happened: Compilation failed due to MIR cycle.

Meta

rustc --version --verbose:

rustc 1.82.0-nightly (0d634185d 2024-08-29)
binary: rustc
commit-hash: 0d634185dfddefe09047881175f35c65d68dcff1
commit-date: 2024-08-29
host: aarch64-apple-darwin
release: 1.82.0-nightly
LLVM version: 19.1.0

Backtrace contained no extra information.

Metadata

Metadata

Labels

A-async-closures`async || {}`A-mir-optArea: MIR optimizationsC-bugCategory: This is a bug.I-cycleIssue: A query cycle occurred while none was expected

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions