rust-lang / rust-lang/rust

queries overflow the depth limit! (core)

Open
#159,736 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug S-needs-info
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

error: queries overflow the depth limit!
   --> ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/num/niche_types.rs:20:41
    |
 20 |           $vis struct $name(pattern_type!($int is $pat));
    |                                           ^^^^
...
115 | / define_valid_range_type! {
116 | |     pub struct NonZeroU8Inner(u8 is 1..);
117 | |     pub struct NonZeroU16Inner(u16 is 1..);
118 | |     pub struct NonZeroU32Inner(u32 is 1..);
...   |
138 | |     pub struct NonZeroCharInner(char is '\u{1}' ..= '\u{10ffff}');
139 | | }
    | |_- in this macro invocation
    |
    = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`example1`)
    = note: query depth increased by 2 when simplifying constant for the type system `<u16 as core::pat::RangePattern>::MAX`
    = note: this error originates in the macro `define_valid_range_type` (in Nightly builds, run with -Z macro-backtrace for more info)

idk really i just updated the compiler (with cargo clean after it)

rustc 1.99.0-nightly (0e29c21d9 2026-07-21)
binary: rustc
commit-hash: 0e29c21d93abc9bdc330182be1fbd33cfd5fee68
commit-date: 2026-07-21
host: x86_64-unknown-linux-gnu
release: 1.99.0-nightly
LLVM version: 22.1.8

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 report with rustc 1.99.0-nightly and the shown compiler output, then inspect library/core/src/num/niche_types.rs around define_valid_range_type!. Determine why simplifying the RangePattern constant exceeds the query depth limit; done means the reported case compiles without requiring a crate-level recursion_limit increase.

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
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.