Skip to content

Refactor GraphQL root MergedObject groups to reduce rustc query-depth overflow on Rust 1.94+ #801

@kimhanbeom

Description

@kimhanbeom

Problem

After upgrading Rust from 1.93.1 to 1.94.0, build/test can fail with:

error: queries overflow the depth limit!
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`minireview`)
= note: query depth increased by 130 when computing layout of `{async block@...QueryRoot<review_web::graphql::Query>...}`

The failure happens while compiling examples/minireview.rs (not from functional GraphQL logic changes).

Current root object shape

pub(super) struct Query(SubQueryOne, SubQueryTwo);
pub(super) struct Mutation(SubMutationOne, SubMutationTwo);

Each sub-object currently contains many merged query/mutation types, which increases derive expansion/type layout complexity.

Suspected cause (why this appears after 1.94.0)

  • The issue is reproducible in our codebase on rustc 1.94.0 (4a4ef493e 2026-03-02), while 1.93.1 (01f6ddf75 2026-02-11) did not hit this limit.
  • A likely contributing change is PR #149775, which added an extra wrapping layer in ManuallyDrop<T> layout paths (T -> MaybeDangling<T>).
  • In async/type-heavy GraphQL root types, this additional layer appears to increase query-depth pressure and make overflow more likely on 1.94+.

Proposal

Refactor root GraphQL objects by splitting the merged groups into smaller units.

  • Keep API/schema behavior unchanged.
  • Only reorganize root merge structure.
  • Avoid relying on #![recursion_limit = "..."] as the primary fix.

Example direction:

pub(super) struct Query(SubQueryOne, SubQueryTwo, SubQueryThree);
pub(super) struct Mutation(SubMutationOne, SubMutationTwo, SubMutationThree);

Acceptance Criteria

  • cargo test --no-default-features --features auth-jwt --verbose passes without queries overflow the depth limit.
  • cargo test --no-default-features --features auth-mtls --verbose passes without queries overflow the depth limit.

Notes

  • This issue is about compile-time robustness across Rust versions (especially 1.94+), not feature changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions