rust-lang / rust-lang/rust-analyzer

3000+ QPS of "WARN Propagating panic for cycle" warnings (const-generic related)

Open
#23,347 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-salsa A-ty C-bug I-panic
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

Rust Analyzer fails during handle_document_diagnostics (which is fine, the features I use are unstable).

However, what follows is a seemingly infinite number of WARN Propagating panic for cycle head that panicked in an earlier execution in that revision lines, at a rate of approximately 2-4 (sometimes more) per millisecond:

2026-09-12T10:14:58.766006+02:00  WARN Propagating panic for cycle head that panicked in an earlier execution in that revision
2026-09-12T10:14:58.766194+02:00  WARN Propagating panic for cycle head that panicked in an earlier execution in that revision
2026-09-12T10:14:58.766392+02:00  WARN Propagating panic for cycle head that panicked in an earlier execution in that revision
2026-09-12T10:14:58.766602+02:00  WARN Propagating panic for cycle head that panicked in an earlier execution in that revision
2026-09-12T10:14:58.766801+02:00  WARN Propagating panic for cycle head that panicked in an earlier execution in that revision
2026-09-12T10:14:58.766976+02:00  WARN Propagating panic for cycle head that panicked in an earlier execution in that revision

It would be great if this could fail more gracefully.

Initial Panic:
thread 'Worker3' (878036) panicked at /Users/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ena-0.14.4/src/snapshot_vec.rs:199:10:
index out of bounds: the len is 0 but the index is 0
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic_bounds_check
   3: <ra_ap_rustc_next_trait_solver::resolve::EagerResolver<hir_ty::next_solver::solver::SolverContext, hir_ty::next_solver::interner::DbInterner> as ra_ap_rustc_type_ir::fold::TypeFolder<hir_ty::next_solver::interner::DbInterner>>::fold_const
   4: <hir_ty::next_solver::generic_arg::GenericArgs as ra_ap_rustc_type_ir::fold::TypeFoldable<hir_ty::next_solver::interner::DbInterner>>::fold_with::<ra_ap_rustc_next_trait_solver::resolve::EagerResolver<hir_ty::next_solver::solver::SolverContext, hir_ty::next_solver::interner::DbInterner>>
   5: <ra_ap_rustc_next_trait_solver::resolve::EagerResolver<hir_ty::next_solver::solver::SolverContext, hir_ty::next_solver::interner::DbInterner> as ra_ap_rustc_type_ir::fold::TypeFolder<hir_ty::next_solver::interner::DbInterner>>::fold_ty
   6: <hir_ty::next_solver::generic_arg::GenericArgs as ra_ap_rustc_type_ir::fold::TypeFoldable<hir_ty::next_solver::interner::DbInterner>>::fold_with::<ra_ap_rustc_next_trait_solver::resolve::EagerResolver<hir_ty::next_solver::solver::SolverContext, hir_ty::next_solver::interner::DbInterner>>
   7: <ra_ap_rustc_type_ir::solve::Goal<hir_ty::next_solver::interner::DbInterner, hir_ty::next_solver::predicate::Predicate> as ra_ap_rustc_type_ir::fold::TypeFoldable<hir_ty::next_solver::interner::DbInterner>>::fold_with::<ra_ap_rustc_next_trait_solver::resolve::EagerResolver<hir_ty::next_solver::solver::SolverContext, hir_ty::next_solver::interner::DbInterner>>
   8: ra_ap_rustc_next_trait_solver::resolve::eager_resolve_vars::<hir_ty::next_solver::solver::SolverContext, (ra_ap_rustc_type_ir::solve::Goal<hir_ty::next_solver::interner::DbInterner, hir_ty::next_solver::predicate::Predicate>, alloc::vec::Vec<(ra_ap_rustc_type_ir::opaque_ty::OpaqueTypeKey<hir_ty::next_solver::interner::DbInterner>, hir_ty::next_solver::ty::Ty)>)>
   9: <hir_ty::next_solver::solver::SolverContext as ra_ap_rustc_next_trait_solver::solve::eval_ctxt::SolverDelegateEvalExt>::evaluate_root_goal_for_proof_tree
  10: <hir_ty::next_solver::infer::InferCtxt>::select
  11: hir_ty::method_resolution::lookup_impl_assoc_item_for_trait_ref
  12: hir_ty::method_resolution::lookup_impl_const
  13: <hir_ty::mir::eval::Evaluator>::eval_operand
  14: <hir_ty::mir::eval::Evaluator>::eval_rvalue
  15: hir_ty::mir::eval::interpret_mir
  16: <hir_ty::consteval::anon_const_eval::_::anon_const_eval_query_Configuration_ as salsa::function::Configuration>::execute
  17: <salsa::function::IngredientImpl<hir_ty::consteval::anon_const_eval::_::anon_const_eval_query_Configuration_>>::execute
  18: hir_ty::consteval::anon_const_eval
  19: <hir_ty::next_solver::solver::SolverContext as ra_ap_rustc_next_trait_solver::delegate::SolverDelegate>::evaluate_const
  20: <ra_ap_rustc_type_ir::search_graph::SearchGraph<ra_ap_rustc_next_trait_solver::solve::search_graph::SearchGraphDelegate<hir_ty::next_solver::solver::SolverContext>, hir_ty::next_solver::interner::DbInterner>>::evaluate_goal_in_task
  21: <ra_ap_rustc_type_ir::search_graph::SearchGraph<ra_ap_rustc_next_trait_solver::solve::search_graph::SearchGraphDelegate<hir_ty::next_solver::solver::SolverContext>, hir_ty::next_solver::interner::DbInterner>>::evaluate_goal
  22: <ra_ap_rustc_next_trait_solver::solve::eval_ctxt::EvalCtxt<hir_ty::next_solver::solver::SolverContext, hir_ty::next_solver::interner::DbInterner>>::try_evaluate_added_goals
  23: <ra_ap_rustc_type_ir::search_graph::SearchGraph<ra_ap_rustc_next_trait_solver::solve::search_graph::SearchGraphDelegate<hir_ty::next_solver::solver::SolverContext>, hir_ty::next_solver::interner::DbInterner>>::evaluate_goal_in_task
  24: <ra_ap_rustc_type_ir::search_graph::SearchGraph<ra_ap_rustc_next_trait_solver::solve::search_graph::SearchGraphDelegate<hir_ty::next_solver::solver::SolverContext>, hir_ty::next_solver::interner::DbInterner>>::evaluate_goal
  25: <ra_ap_rustc_next_trait_solver::solve::eval_ctxt::EvalCtxt<hir_ty::next_solver::solver::SolverContext, hir_ty::next_solver::interner::DbInterner>>::evaluate_goal
  26: <ra_ap_rustc_next_trait_solver::solve::eval_ctxt::EvalCtxt<hir_ty::next_solver::solver::SolverContext, hir_ty::next_solver::interner::DbInterner>>::try_evaluate_added_goals
  27: <ra_ap_rustc_next_trait_solver::solve::eval_ctxt::EvalCtxt<hir_ty::next_solver::solver::SolverContext, hir_ty::next_solver::interner::DbInterner>>::evaluate_added_goals_and_make_canonical_response
  28: <ra_ap_rustc_next_trait_solver::solve::eval_ctxt::EvalCtxt<hir_ty::next_solver::solver::SolverContext, hir_ty::next_solver::interner::DbInterner>>::assemble_impl_candidates::<ra_ap_rustc_type_ir::predicate::TraitPredicate<hir_ty::next_solver::interner::DbInterner>>::{closure#0}
  29: <ra_ap_rustc_next_trait_solver::solve::eval_ctxt::EvalCtxt<hir_ty::next_solver::solver::SolverContext, hir_ty::next_solver::interner::DbInterner>>::compute_trait_goal
  30: <ra_ap_rustc_type_ir::search_graph::SearchGraph<ra_ap_rustc_next_trait_solver::solve::search_graph::SearchGraphDelegate<hir_ty::next_solver::solver::SolverContext>, hir_ty::next_solver::interner::DbInterner>>::evaluate_goal_in_task
  31: <ra_ap_rustc_type_ir::search_graph::SearchGraph<ra_ap_rustc_next_trait_solver::solve::search_graph::SearchGraphDelegate<hir_ty::next_solver::solver::SolverContext>, hir_ty::next_solver::interner::DbInterner>>::evaluate_goal
  32: <hir_ty::next_solver::fulfill::FulfillmentCtxt>::try_evaluate_obligations
  33: <hir_ty::infer::InferenceContext>::infer_path
  34: <hir_ty::infer::InferenceContext>::infer_expr_inner
  35: <hir_ty::infer::InferenceContext>::infer_call
  36: <hir_ty::infer::InferenceContext>::infer_expr_inner
  37: <hir_ty::infer::InferenceContext>::infer_expr_inner
  38: <hir_ty::infer::InferenceContext>::infer_return
  39: hir_ty::infer::infer_query_with_inspect
  40: <salsa::function::IngredientImpl<<hir_ty::infer::InferenceResult>::for_body::_::for_body__Configuration_>>::execute
  41: <hir_ty::infer::InferenceResult>::for_body
  42: <hir::diagnostics::DiagnosticsCollector>::emit_inference_errors
  43: <hir::diagnostics::DiagnosticsCollector>::collect_def_with_body
  44: <hir::diagnostics::DiagnosticsCollector>::collect_module_def
  45: <hir::diagnostics::DiagnosticsCollector>::collect_module
  46: <hir::Module>::diagnostics
  47: ide_diagnostics::semantic_diagnostics
  48: ide_diagnostics::full_diagnostics
  49: <ide::Analysis>::full_diagnostics
  50: rust_analyzer::handlers::request::handle_document_diagnostics
  51: <<stdx::thread::pool::Pool>::spawn<<rust_analyzer::task_pool::TaskPool<rust_analyzer::main_loop::Task>>::spawn<<rust_analyzer::handlers::dispatch::RequestDispatcher>::on_with_thread_intent<false, false, gen_lsp_types::generated::requests::DocumentDiagnosticRequest>::{closure#0}>::{closure#0}>::{closure#0} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
query stacktrace:
   0: anon_const_eval_query(Id(16700)) -> (R3298, Durability::LOW)
             at crates/hir-ty/src/consteval.rs:519
   1: InferenceResult < 'db >::for_body_(Id(2101)) -> (R3298, Durability::LOW)
             at crates/hir-ty/src/infer.rs:1077

additional context:
   0: 
version: 0.4.3046-standalone (6aeeb8cf02 2026-09-11)
request: textDocument/diagnostic DocumentDiagnosticParams {
    text_document: TextDocumentIdentifier {
        uri: Url {
            scheme: "file",
            cannot_be_a_base: false,
            username: "",
            password: None,
            host: None,
            port: None,
            path: "<redacted>",
            query: None,
            fragment: None,
        },
    },
    identifier: Some(
        "rust-analyzer",
    ),
    previous_result_id: None,
    work_done_progress_params: WorkDoneProgressParams {
        work_done_token: None,
    },
    partial_result_params: PartialResultParams {
        partial_result_token: None,
    },
}

rust-analyzer version: rust-analyzer version: 0.4.3046-standalone (6aeeb8cf02 2026-09-11)

rustc version: rustc 1.100.0-nightly (0fc141305 2026-09-11)

editor or extension: VS Code with rust-lang.rust-analyzer version 0.4.3046

relevant settings: n/a

repository link (if public, optional): n/a

code snippet to reproduce:

#![allow(incomplete_features)]
#![feature(
    portable_simd,
    min_generic_const_args,
    macroless_generic_const_args
)]

use std::simd::Simd;

pub trait Calc {
    type const V: usize;
}

pub struct Mul<const N: usize, const M: usize>;

impl Calc for Mul<4, 2> {
    type const V: usize = const { 8 };
}

impl Calc for Mul<4, 4> {
    type const V: usize = const { 16 };
}

// Commenting the next two impls stops the log spam.

impl Calc for Mul<2, 2> {
    type const V: usize = const { 8 };
}

impl Calc for Mul<2, 4> {
    type const V: usize = const { 8 };
}

type SimdM<T, const N: usize, const M: usize> = Simd<T, { <Mul<N, M> as Calc>::V }>;

pub fn repro_gen<const N: usize>(_: &[u32; N])
where
    Mul<N, 2>: Calc,
    Mul<N, 4>: Calc,
    SimdM<u16, N, 2>: Copy,
{
}

pub fn repro() {
    repro_gen(&[0u32; 4]);
    // Explicitly specifying the `<4>` stops the log spam
    // repro_gen::<4>(&[0u32; 4]);
}

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

Start by reproducing the warning storm through handle_document_diagnostics with the provided const-generic example and inspect the query stack at crates/hir-ty/src/consteval.rs:519 and crates/hir-ty/src/infer.rs:1077. Trace the panic propagation shown through hir_ty and diagnostics, then verify that the repro no longer emits thousands of WARN lines and fails gracefully.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.