rust-lang / rust-lang/rust

[ICE]: error: internal compiler error: query cycle when printing cycle detected / no backtrace

Open
#155,271 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug I-cycle I-ICE needs-triage T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code
trait Default {}
use std::num::NonZero;
fn main() {
    NonZero();
    feature!();
}
Meta

rustc --version --verbose:

rustc 1.97.0-nightly (17584a181 2026-04-13)
binary: rustc
commit-hash: 17584a181979f04f2aaad867332c22db1caa511a
commit-date: 2026-04-13
host: x86_64-unknown-linux-gnu
release: 1.97.0-nightly
LLVM version: 22.1.2
Error output
error: cannot find macro `feature` in this scope
 --> code.rs:5:5
  |
5 |     feature!();
  |     ^^^^^^^
  |
  = note: `feature` is in scope, but it is an attribute: `#[feature]`

error: internal compiler error: query cycle when printing cycle detected
  |
  = note: ...when getting HIR ID of `Default`
  = note: ...which requires getting the crate HIR...
  = note: ...which requires perform lints prior to AST lowering...
  = note: ...which requires looking up span for `Default`...
  = note: ...which again requires getting HIR ID of `Default`, completing the cycle
  = note: cycle used when getting the resolver for lowering
  = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information

error[E0391]: cycle detected when getting the resolver for lowering
  |
  = note: ...which requires getting HIR ID of `Default`...
  = note: ...which requires getting the crate HIR...
  = note: ...which requires perform lints prior to AST lowering...
  = note: ...which again requires getting the resolver for lowering, completing the cycle
  = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0391`.
Backtrace

<backtrace>

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 from code.rs with the reported rustc nightly version and inspect the resolver-for-lowering and HIR query cycle described in the diagnostics. Determine why the missing feature! macro and related cycle produce an internal compiler error; done means the example no longer ICEs and reports an appropriate diagnostic.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.