Skip to content

Polymorphic recursion in async fn gives "queries overflow the depth limit" error #140728

Open
@theemathas

Description

@theemathas

Code

async fn recurse<T>() {
    recurse::<Option<T>>().await;
}

Current output

error: queries overflow the depth limit!
  |
  = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`playground`)
  = note: query depth increased by 130 when computing layout of `{async fn body of recurse<T>()}`

Desired output

Something that doesn't mention queries, and more prominently point me towards the recurse() function being the problem.

Rationale and extra context

No response

Other cases

Rust Version

Reproducible on the playground with version: 1.88.0-nightly (2025-05-06 27d6200a70601f6fcf41)

Anything else?

Discovered while experimenting with #140725

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-async-awaitArea: Async & AwaitA-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.I-cycleIssue: A query cycle occurred while none was expectedT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions