rust-lang / rust-lang/rust-analyzer

panic: `dependency graph cycle when querying StructSignature::with_source_map_(Id(3400)), set cycle_fn/cycle_initial to fixpoint iterate.`, missing type

Open
#22,838 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

struct N < const N = { let N; }>

RUST_BACKTRACE=full RUSTFLAGS="" ~/.rustup/toolchains/master/bin/rust-analyzer highlight < code.rs

thread 'main' (1300816) panicked at /rust/deps/salsa-0.27.2/src/function/fetch.rs:169:21:
dependency graph cycle when querying StructSignature::with_source_map_(Id(3400)), set cycle_fn/cycle_initial to fixpoint iterate.
Query stack:
[
    StructSignature::with_source_map_(Id(3400)),
    StructSignature::of_(Id(3400)),
    real_span_map(Id(2800)),
    parse(Id(2800)),
]
stack backtrace:
   0:     0x7f4e2964bed6 - <<std[cf0678d25afc9ccf]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[9662e8fc1527f23c]::fmt::Display>::fmt
   1:     0x7f4e29c0f0c8 - core[9662e8fc1527f23c]::fmt::write
   2:     0x7f4e2966113c - <std[cf0678d25afc9ccf]::sys::stdio::unix::Stderr as core[9662e8fc1527f23c]::io::write::Write>::write_fmt
   3:     0x7f4e2961e04a - std[cf0678d25afc9ccf]::panicking::default_hook::{closure#0}
   4:     0x7f4e2963e5f3 - std[cf0678d25afc9ccf]::panicking::default_hook
   5:     0x7f4e2963ea5b - std[cf0678d25afc9ccf]::panicking::panic_with_hook
   6:     0x7f4e2961e102 - std[cf0678d25afc9ccf]::panicking::panic_handler::{closure#0}
   7:     0x7f4e29616a89 - std[cf0678d25afc9ccf]::sys::backtrace::__rust_end_short_backtrace::<std[cf0678d25afc9ccf]::panicking::panic_handler::{closure#0}, !>
   8:     0x7f4e2961fa5d - __rustc[c7d2cd00dee8f709]::rust_begin_unwind
   9:     0x7f4e26360bac - core[9662e8fc1527f23c]::panicking::panic_fmt
  10:     0x562e6b59bfaa - <salsa[65a99894a6a39c25]::function::IngredientImpl<<hir_def[36b966b8558e1ecf]::signatures::TraitSignature>::of::_::of__Configuration_>>::fetch_cold_cycle
  11:     0x562e6b508500 - <std[cf0678d25afc9ccf]::thread::local::LocalKey<salsa[65a99894a6a39c25]::attach::Attached>>::try_with::<salsa[65a99894a6a39c25]::attach::attach<&(triomphe[c32a42f819e6620a]::arc::Arc<hir_def[36b966b8558e1ecf]::signatures::StructSignature>, hir_def[36b966b8558e1ecf]::expr_store::ExpressionStoreSourceMap), dyn base_db[1ece6b420f9ff01c]::SourceDatabase, <hir_def[36b966b8558e1ecf]::signatures::StructSignature>::with_source_map::with_source_map_::{closure#0}>::{closure#0}, &(triomphe[c32a42f819e6620a]::arc::Arc<hir_def[36b966b8558e1ecf]::signatures::StructSignature>, hir_def[36b966b8558e1ecf]::expr_store::ExpressionStoreSourceMap)>
  12:     0x562e6b5b5f5e - <salsa[65a99894a6a39c25]::function::IngredientImpl<<hir_def[36b966b8558e1ecf]::signatures::StructSignature>::of::_::of__Configuration_>>::execute
  13:     0x562e6b685feb - <hir_def[36b966b8558e1ecf]::signatures::StructSignature>::of::of_
  14:     0x562e6b5f8f4b - <hir_def[36b966b8558e1ecf]::expr_store::lower::ExprCollector>::collect_pat
  15:     0x562e6b5fff9b - <hir_def[36b966b8558e1ecf]::expr_store::lower::ExprCollector>::collect_pat_top
  16:     0x562e6b5fa71f - <hir_def[36b966b8558e1ecf]::expr_store::lower::ExprCollector>::collect_stmt
  17:     0x562e6b4ffc08 - <hir_def[36b966b8558e1ecf]::expr_store::lower::ExprCollector>::collect_block_::<<hir_def[36b966b8558e1ecf]::expr_store::lower::ExprCollector>::collect_block::{closure#0}>
  18:     0x562e6b6069d8 - <hir_def[36b966b8558e1ecf]::expr_store::lower::ExprCollector>::maybe_collect_expr
  19:     0x562e6b5060c3 - <hir_def[36b966b8558e1ecf]::expr_store::lower::ExprCollector>::with_expr_root::<<hir_def[36b966b8558e1ecf]::expr_store::lower::ExprCollector>::with_fresh_binding_expr_root<<hir_def[36b966b8558e1ecf]::expr_store::lower::ExprCollector>::lower_const_arg::{closure#0}>::{closure#0}>
  20:     0x562e6b5d7289 - <hir_def[36b966b8558e1ecf]::expr_store::lower::generics::GenericParamsCollector>::lower_param_list
  21:     0x562e6b66c46d - hir_def[36b966b8558e1ecf]::expr_store::lower::lower_generic_params
  22:     0x562e6b69bea8 - <hir_def[36b966b8558e1ecf]::signatures::StructSignature as <hir_def[36b966b8558e1ecf]::signatures::StructSignature>::with_source_map::InnerTrait_>::with_source_map_
  23:     0x562e6b5b51ec - <salsa[65a99894a6a39c25]::function::IngredientImpl<<hir_def[36b966b8558e1ecf]::signatures::StructSignature>::with_source_map::_::with_source_map__Configuration_>>::execute
  24:     0x562e6b50825b - <std[cf0678d25afc9ccf]::thread::local::LocalKey<salsa[65a99894a6a39c25]::attach::Attached>>::try_with::<salsa[65a99894a6a39c25]::attach::attach<&(triomphe[c32a42f819e6620a]::arc::Arc<hir_def[36b966b8558e1ecf]::signatures::StructSignature>, hir_def[36b966b8558e1ecf]::expr_store::ExpressionStoreSourceMap), dyn base_db[1ece6b420f9ff01c]::SourceDatabase, <hir_def[36b966b8558e1ecf]::signatures::StructSignature>::with_source_map::with_source_map_::{closure#0}>::{closure#0}, &(triomphe[c32a42f819e6620a]::arc::Arc<hir_def[36b966b8558e1ecf]::signatures::StructSignature>, hir_def[36b966b8558e1ecf]::expr_store::ExpressionStoreSourceMap)>
  25:     0x562e6b61bb9f - <hir_def[36b966b8558e1ecf]::hir::generics::GenericParams>::with_source_map
  26:     0x562e6b4e033c - <hir_def[36b966b8558e1ecf]::GenericDefId as hir[c107f094967a75ab]::semantics::child_by_source::ChildBySource>::child_by_source_to
  27:     0x562e6b4b5394 - <hir[c107f094967a75ab]::semantics::source_to_def::SourceToDefCtx>::cache_for
  28:     0x562e6b4b3844 - <hir[c107f094967a75ab]::semantics::source_to_def::SourceToDefCtx>::const_param_to_def
  29:     0x562e6c20da24 - <hir[c107f094967a75ab]::semantics::SemanticsImpl>::to_def::<syntax[88d6ea7446ced16c]::ast::generated::nodes::ConstParam>
  30:     0x562e6c27ed70 - <ide_db[d022570643ec6e19]::defs::NameClass>::classify
  31:     0x562e6bdf14a1 - ide[37737ece80204ca3]::syntax_highlighting::highlight
  32:     0x562e6be2ae6e - ide[37737ece80204ca3]::syntax_highlighting::html::highlight_as_html_with_config
  33:     0x562e6bd91dec - <ide[37737ece80204ca3]::Analysis>::highlight_as_html
  34:     0x562e6c7e0872 - <rust_analyzer[c9a7b5a74bd4f6b9]::cli::flags::Highlight>::run
  35:     0x562e6ca80034 - rust_analyzer[e3769bb504499c95]::main
  36:     0x562e6ca16713 - std[cf0678d25afc9ccf]::sys::backtrace::__rust_begin_short_backtrace::<fn() -> core[9662e8fc1527f23c]::result::Result<std[cf0678d25afc9ccf]::process::ExitCode, anyhow[6279a09abd95b935]::Error>, core[9662e8fc1527f23c]::result::Result<std[cf0678d25afc9ccf]::process::ExitCode, anyhow[6279a09abd95b935]::Error>>
  37:     0x562e6ca79082 - std[cf0678d25afc9ccf]::rt::lang_start::<core[9662e8fc1527f23c]::result::Result<std[cf0678d25afc9ccf]::process::ExitCode, anyhow[6279a09abd95b935]::Error>>::{closure#0}
  38:     0x7f4e2ad6af99 - std[cf0678d25afc9ccf]::rt::lang_start_internal
  39:     0x562e6ca99148 - main
  40:     0x7f4e24627741 - <unknown>
  41:     0x7f4e24627879 - __libc_start_main
  42:     0x562e6b38a6e9 - <unknown>
  43:                0x0 - <unknown>

rust-analyzer 1.99.0-nightly (d62fb1c 2026-07-16)

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 panic with the shown Rust snippet and the rust-analyzer highlight command. Start at ide::syntax_highlighting::highlight and follow the stack through hir_def::signatures::StructSignature and expr_store::lower. Done means this input can be highlighted without a dependency-cycle panic.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.