rust-lang / rust-lang/rust-analyzer

panic: mir lowering `no entry found for key`

Open
#22,845 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

fn main() { let _: [(); { |x: u32| { x }; 4 }]; }

code sompiles with rustc

RUST_BACKTRACE=full ~/.rustup/toolchains/master/bin/rust-analyzer analysis-stats --run-all-ide-things .

Database loaded:     344.53ms, 224minstr, 48mb (metadata 193.23ms, 926kinstr, 150kb; build 18.90ms, 165kinstr, 1088b)
  item trees: 1
  dependency lines of code: 1_462_980, item trees: 2_900
  dependency item stats: traits: 851, impl: 9_703, mods: 3_013, macro calls: 5_502, macro rules: 1_053
Item Tree Collection: 2.07s, 22ginstr, 425mb
  Total Statistics:
1    crates: 1, mods: 1, decls: 1, bodies: 1, adts: 0, consts: 0, signatures: 1, variants: 0
  Workspace:
    traits: 0, macro_rules macros: 0, proc_macros: 0
    lines of code: 5, item trees: 1
    usages: traits: 0, impl: 0, mods: 0, macro calls: 0, macro rules: 0
  Dependencies:
    lines of code: 1_462_980, item trees: 2_900
    declarations: traits: 851, impl: 9_703, mods: 3_013, macro calls: 5_502, macro rules: 1_053
Item Collection:     1.15s, 11ginstr, 177mb
Crate lang items:    233.20ms, 2471minstr, 31mb
Expression Store Lowering: 125.69µs, 165kinstr, 3968b
0/1 0% processing: a::main
thread 'main' (826510) panicked at src/tools/rust-analyzer/crates/hir-ty/src/mir/lower.rs:1258:61:
no entry found for key
stack backtrace:
   0:     0x7f1b0e62a786 - <<std[1e37345aeca07a33]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[702fd8b52481f6b]::fmt::Display>::fmt
   1:     0x7f1b0ec0f108 - core[702fd8b52481f6b]::fmt::write
   2:     0x7f1b0e63f9ec - <std[1e37345aeca07a33]::sys::stdio::unix::Stderr as core[702fd8b52481f6b]::io::write::Write>::write_fmt
   3:     0x7f1b0e5fc40a - std[1e37345aeca07a33]::panicking::default_hook::{closure#0}
   4:     0x7f1b0e61cea3 - std[1e37345aeca07a33]::panicking::default_hook
   5:     0x7f1b0e61d30b - std[1e37345aeca07a33]::panicking::panic_with_hook
   6:     0x7f1b0e5fc4c2 - std[1e37345aeca07a33]::panicking::panic_handler::{closure#0}
   7:     0x7f1b0e5f3959 - std[1e37345aeca07a33]::sys::backtrace::__rust_end_short_backtrace::<std[1e37345aeca07a33]::panicking::panic_handler::{closure#0}, !>
   8:     0x7f1b0e5fde1d - __rustc[c13b5280399c33fa]::rust_begin_unwind
   9:     0x7f1b0b2ea73c - core[702fd8b52481f6b]::panicking::panic_fmt
  10:     0x7f1b0c2ef724 - core[702fd8b52481f6b]::option::expect_failed
  11:     0x55fe3915fbf3 - <hir_ty[e0bea5ffe6249590]::mir::lower::MirLowerCtx>::lower_expr_to_place_without_adjust
  12:     0x55fe390f6325 - <hir_ty[e0bea5ffe6249590]::mir::lower::MirLowerCtx>::lower_expr_to_some_place_without_adjust
  13:     0x55fe39157eb4 - <hir_ty[e0bea5ffe6249590]::mir::lower::MirLowerCtx>::lower_block_to_place
  14:     0x55fe3915b07a - <hir_ty[e0bea5ffe6249590]::mir::lower::MirLowerCtx>::lower_expr_to_place_without_adjust
  15:     0x55fe39157b71 - <hir_ty[e0bea5ffe6249590]::mir::lower::MirLowerCtx>::lower_expr_to_place
  16:     0x55fe39207175 - hir_ty[e0bea5ffe6249590]::mir::lower::lower_body_to_mir
  17:     0x55fe39282bb1 - <hir_ty[e0bea5ffe6249590]::mir::lower::_::mir_body_query_Configuration_ as salsa[6da196d40d999542]::function::Configuration>::execute
  18:     0x55fe3909054b - <salsa[6da196d40d999542]::function::IngredientImpl<hir_ty[e0bea5ffe6249590]::mir::lower::_::mir_body_query_Configuration_>>::execute
  19:     0x55fe39206507 - hir_ty[e0bea5ffe6249590]::mir::lower::mir_body_query
  20:     0x55fe3a042117 - <ide_db[638de82cedb9c87c]::RootDatabase as hir_ty[e0bea5ffe6249590]::db::HirDatabase>::mir_body
  21:     0x55fe3927f867 - <hir_ty[e0bea5ffe6249590]::mir::monomorphization::_::monomorphized_mir_body_query_Configuration_ as salsa[6da196d40d999542]::function::Configuration>::execute
  22:     0x55fe3908ce5d - <salsa[6da196d40d999542]::function::IngredientImpl<hir_ty[e0bea5ffe6249590]::mir::monomorphization::_::monomorphized_mir_body_query_Configuration_>>::execute
  23:     0x55fe39200279 - hir_ty[e0bea5ffe6249590]::mir::monomorphization::monomorphized_mir_body_query
  24:     0x55fe3a041e67 - <ide_db[638de82cedb9c87c]::RootDatabase as hir_ty[e0bea5ffe6249590]::db::HirDatabase>::monomorphized_mir_body
  25:     0x55fe3928556a - <hir_ty[e0bea5ffe6249590]::consteval::anon_const_eval::_::anon_const_eval_query_Configuration_ as salsa[6da196d40d999542]::function::Configuration>::execute
  26:     0x55fe390a602b - <salsa[6da196d40d999542]::function::IngredientImpl<hir_ty[e0bea5ffe6249590]::consteval::anon_const_eval::_::anon_const_eval_query_Configuration_>>::execute
  27:     0x55fe391f813c - hir_ty[e0bea5ffe6249590]::consteval::anon_const_eval
  28:     0x55fe3a041cc4 - <ide_db[638de82cedb9c87c]::RootDatabase as hir_ty[e0bea5ffe6249590]::db::HirDatabase>::anon_const_eval
  29:     0x55fe392639c3 - <hir_ty[e0bea5ffe6249590]::next_solver::solver::SolverContext as ra_ap_rustc_next_trait_solver[550ca1f3e128fc40]::delegate::SolverDelegate>::evaluate_const
  30:     0x55fe3917fc5b - <ra_ap_rustc_type_ir[e97d49aadf028198]::search_graph::SearchGraph<ra_ap_rustc_next_trait_solver[550ca1f3e128fc40]::solve::search_graph::SearchGraphDelegate<hir_ty[e0bea5ffe6249590]::next_solver::solver::SolverContext>, hir_ty[e0bea5ffe6249590]::next_solver::interner::DbInterner>>::evaluate_goal_in_task
  31:     0x55fe39174d98 - <ra_ap_rustc_type_ir[e97d49aadf028198]::search_graph::SearchGraph<ra_ap_rustc_next_trait_solver[550ca1f3e128fc40]::solve::search_graph::SearchGraphDelegate<hir_ty[e0bea5ffe6249590]::next_solver::solver::SolverContext>, hir_ty[e0bea5ffe6249590]::next_solver::interner::DbInterner>>::evaluate_goal
  32:     0x55fe3910a85a - <ra_ap_rustc_next_trait_solver[550ca1f3e128fc40]::solve::eval_ctxt::EvalCtxt<hir_ty[e0bea5ffe6249590]::next_solver::solver::SolverContext, hir_ty[e0bea5ffe6249590]::next_solver::interner::DbInterner>>::evaluate_goal_raw
  33:     0x55fe3910ba6f - <ra_ap_rustc_next_trait_solver[550ca1f3e128fc40]::solve::eval_ctxt::EvalCtxt<hir_ty[e0bea5ffe6249590]::next_solver::solver::SolverContext, hir_ty[e0bea5ffe6249590]::next_solver::interner::DbInterner>>::try_evaluate_added_goals
  34:     0x55fe3917d374 - <ra_ap_rustc_type_ir[e97d49aadf028198]::search_graph::SearchGraph<ra_ap_rustc_next_trait_solver[550ca1f3e128fc40]::solve::search_graph::SearchGraphDelegate<hir_ty[e0bea5ffe6249590]::next_solver::solver::SolverContext>, hir_ty[e0bea5ffe6249590]::next_solver::interner::DbInterner>>::evaluate_goal_in_task
  35:     0x55fe39174d98 - <ra_ap_rustc_type_ir[e97d49aadf028198]::search_graph::SearchGraph<ra_ap_rustc_next_trait_solver[550ca1f3e128fc40]::solve::search_graph::SearchGraphDelegate<hir_ty[e0bea5ffe6249590]::next_solver::solver::SolverContext>, hir_ty[e0bea5ffe6249590]::next_solver::interner::DbInterner>>::evaluate_goal
  36:     0x55fe3910a85a - <ra_ap_rustc_next_trait_solver[550ca1f3e128fc40]::solve::eval_ctxt::EvalCtxt<hir_ty[e0bea5ffe6249590]::next_solver::solver::SolverContext, hir_ty[e0bea5ffe6249590]::next_solver::interner::DbInterner>>::evaluate_goal_raw
  37:     0x55fe39109779 - <ra_ap_rustc_next_trait_solver[550ca1f3e128fc40]::solve::eval_ctxt::EvalCtxt<hir_ty[e0bea5ffe6249590]::next_solver::solver::SolverContext, hir_ty[e0bea5ffe6249590]::next_solver::interner::DbInterner>>::evaluate_goal
  38:     0x55fe39333f27 - <hir_ty[e0bea5ffe6249590]::next_solver::solver::SolverContext as ra_ap_rustc_next_trait_solver[550ca1f3e128fc40]::solve::eval_ctxt::SolverDelegateEvalExt>::evaluate_root_goal
  39:     0x55fe3911d3b5 - <hir_ty[e0bea5ffe6249590]::next_solver::fulfill::FulfillmentCtxt>::try_evaluate_obligations
  40:     0x55fe390b7c89 - <hir_ty[e0bea5ffe6249590]::next_solver::normalize::NormalizationFolder>::normalize_alias_term
  41:     0x55fe393383c5 - <hir_ty[e0bea5ffe6249590]::next_solver::normalize::NormalizationFolder as ra_ap_rustc_type_ir[e97d49aadf028198]::fold::FallibleTypeFolder<hir_ty[e0bea5ffe6249590]::next_solver::interner::DbInterner>>::try_fold_const
  42:     0x55fe390022d5 - <hir_ty[e0bea5ffe6249590]::next_solver::ty::Ty as ra_ap_rustc_type_ir[e97d49aadf028198]::fold::TypeSuperFoldable<hir_ty[e0bea5ffe6249590]::next_solver::interner::DbInterner>>::try_super_fold_with::<hir_ty[e0bea5ffe6249590]::next_solver::normalize::NormalizationFolder>
  43:     0x55fe39337e72 - <hir_ty[e0bea5ffe6249590]::next_solver::normalize::NormalizationFolder as ra_ap_rustc_type_ir[e97d49aadf028198]::fold::FallibleTypeFolder<hir_ty[e0bea5ffe6249590]::next_solver::interner::DbInterner>>::try_fold_ty
  44:     0x55fe38f64d59 - hir_ty[e0bea5ffe6249590]::next_solver::normalize::deeply_normalize_with_skipped_universes_and_ambiguous_coroutine_goals::<hir_ty[e0bea5ffe6249590]::next_solver::ty::Ty>
  45:     0x55fe38ebbac2 - <hir_ty[e0bea5ffe6249590]::infer::unify::resolve_completely::Resolver>::handle_term::<hir_ty[e0bea5ffe6249590]::next_solver::ty::Ty, <hir_ty[e0bea5ffe6249590]::infer::unify::resolve_completely::Resolver as ra_ap_rustc_type_ir[e97d49aadf028198]::fold::TypeFolder<hir_ty[e0bea5ffe6249590]::next_solver::interner::DbInterner>>::fold_ty::{closure#0}>
  46:     0x55fe38ea1d8b - <hir_ty[e0bea5ffe6249590]::infer::unify::resolve_completely::WriteBackCtxt>::resolve_completely::<hir_ty[e0bea5ffe6249590]::next_solver::ty::StoredTy>
  47:     0x55fe391d58de - hir_ty[e0bea5ffe6249590]::infer::infer_finalize
  48:     0x55fe391de9cf - hir_ty[e0bea5ffe6249590]::infer::infer_query_with_inspect
  49:     0x55fe39099584 - <salsa[6da196d40d999542]::function::IngredientImpl<<hir_ty[e0bea5ffe6249590]::infer::InferenceResult>::for_body::_::for_body__Configuration_>>::execute
  50:     0x55fe38e98eb7 - <salsa[6da196d40d999542]::attach::Attached>::attach::<dyn hir_ty[e0bea5ffe6249590]::db::HirDatabase, &hir_ty[e0bea5ffe6249590]::infer::InferenceResult, <hir_ty[e0bea5ffe6249590]::infer::InferenceResult>::for_body::for_body_::{closure#0}>
  51:     0x55fe39e3bdbf - <rust_analyzer[29694c28a86a0685]::cli::flags::AnalysisStats>::run_inference
  52:     0x55fe39de9534 - <rust_analyzer[29694c28a86a0685]::cli::flags::AnalysisStats>::run::{closure#3}
  53:     0x55fe39e47fb9 - <rust_analyzer[29694c28a86a0685]::cli::flags::AnalysisStats>::run
  54:     0x55fe3a0f1d62 - rust_analyzer[b45ee5f09a5d6ebe]::main
  55:     0x55fe3a088593 - std[1e37345aeca07a33]::sys::backtrace::__rust_begin_short_backtrace::<fn() -> core[702fd8b52481f6b]::result::Result<std[1e37345aeca07a33]::process::ExitCode, anyhow[f29ba2bc3bec5daa]::Error>, core[702fd8b52481f6b]::result::Result<std[1e37345aeca07a33]::process::ExitCode, anyhow[f29ba2bc3bec5daa]::Error>>
  56:     0x55fe3a0eaf02 - std[1e37345aeca07a33]::rt::lang_start::<core[702fd8b52481f6b]::result::Result<std[1e37345aeca07a33]::process::ExitCode, anyhow[f29ba2bc3bec5daa]::Error>>::{closure#0}
  57:     0x7f1b0fd9d099 - std[1e37345aeca07a33]::rt::lang_start_internal
  58:     0x55fe3a10afe8 - main
  59:     0x7f1b09627741 - <unknown>
  60:     0x7f1b09627879 - __libc_start_main
  61:     0x55fe389fc629 - <unknown>
  62:                0x0 - <unknown>
infer panicked for a::main: no entry found for key
  exprs: 0, ??ty: 0 (100%), ?ty: 0 (100%), !ty: 0
  pats: 0, ??ty: 0 (100%), ?ty: 0 (100%), !ty: 0
  panics: 1
Inference:           12.47ms, 62minstr, 7mb
1/1 100% mir lowering: a::main2026-07-17T17:33:46.238777284+02:00  WARN Propagating panic for cycle head that panicked in an earlier execution in that revision

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 minimal Rust snippet and the analysis-stats command from the issue. Start at src/tools/rust-analyzer/crates/hir-ty/src/mir/lower.rs:1258 and trace the MIR lowering path shown in the backtrace; done means analysis-stats completes without the "no entry found for key" panic.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.