Skip to content

Query depth limit overflow due to nested async fn when building matrix_sdk #152942

@Chiffario

Description

@Chiffario

Problem

When using latest nightly (cargo 1.95.0-nightly (ce69df6f7 2026-02-12)), trying to build a project with matrix-sdk causes the following error

error: queries overflow the depth limit!
  |
  = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`matrix_sdk`)
  = note: query depth increased by 130 when computing layout of `{async fn body of client::<impl at /home/chiffa/.local/share/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/matrix-sdk-0.16.0/src/client/mod.rs:488:1: 488:12>::sync()}`

error: could not compile `matrix-sdk` (lib) due to 1 previous error

building the same project on stable cargo/rustc does not reproduce the error. There are no nightly-specific flags used and no cargo options either

Steps

Simplified

  1. Clone https://github.com/Chiffario/matrix-osu-bot or add matrix-sdk as a dependency to a new project
  2. Attempt building with nightly compiler

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.95.0-nightly (ce69df6f7 2026-02-12)
release: 1.95.0-nightly
commit-hash: ce69df6f72a3b6a2b5c722ba68ddef255344b31c
commit-date: 2026-02-12
host: x86_64-unknown-linux-gnu
libgit2: 1.9.2 (sys:0.20.4 vendored)
libcurl: 8.15.0-DEV (sys:0.4.83+curl-8.15.0 vendored ssl:OpenSSL/3.5.4)
ssl: OpenSSL 3.5.4 30 Sep 2025
os: Arch Linux Rolling Release [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-query-systemArea: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html)C-bugCategory: This is a bug.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleT-libsRelevant to the library team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions