rust-lang / rust-lang/rust

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

Open
#152,942 21 comments 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-query-system C-bug E-needs-mcve regression-from-stable-to-stable T-compiler T-types
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

View all comments

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]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure by building a project that depends on matrix-sdk with the specified nightly, then compare the result with stable Rust. Start from the query-depth overflow while computing layout for the async client::sync function in matrix-sdk's client/mod.rs at line 488. Done means the nightly build no longer overflows without requiring a recursion-limit workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.