rust-lang / rust-lang/rust-analyzer
panic `No generics for EnumVariantId`
Open
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
enum Foo {
Bar = (|x: i32| { }, 42).1,
}
fn main() {}
this compiles with rustc
rust-analyzer highlight < code.rs
thread 'main' (3181265) panicked at src/tools/rust-analyzer/crates/hir-ty/src/next_solver/generics.rs:45:14:
No generics for EnumVariantId("Foo::Bar")
stack backtrace:
0: 0x7fcdda01f986 - <<std[14b872c6dbd886e0]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[a6950792ababbd1]::fmt::Display>::fmt
1: 0x7fcdda60d908 - core[a6950792ababbd1]::fmt::write
2: 0x7fcdda034adc - <std[14b872c6dbd886e0]::sys::stdio::unix::Stderr as core[a6950792ababbd1]::io::write::Write>::write_fmt
3: 0x7fcdd9ff15ba - std[14b872c6dbd886e0]::panicking::default_hook::{closure#0}
4: 0x7fcdda012023 - std[14b872c6dbd886e0]::panicking::default_hook
5: 0x7fcdda01248b - std[14b872c6dbd886e0]::panicking::panic_with_hook
6: 0x7fcdd9ff1672 - std[14b872c6dbd886e0]::panicking::panic_handler::{closure#0}
7: 0x7fcdd9fe8009 - std[14b872c6dbd886e0]::sys::backtrace::__rust_end_short_backtrace::<std[14b872c6dbd886e0]::panicking::panic_handler::{closure#0}, !>
8: 0x7fcdd9ff2fcd - __rustc[d223ed2f55e2e6b0]::rust_begin_unwind
9: 0x7fcdd6b9fd0c - core[a6950792ababbd1]::panicking::panic_fmt
10: 0x55bae7ac6db6 - <hir_ty[5d72008b13b2c614]::next_solver::interner::DbInterner as ra_ap_rustc_type_ir[99cb08e680722369]::interner::Interner>::generics_of
11: 0x55bae7ad3df8 - <hir_ty[5d72008b13b2c614]::next_solver::generic_arg::GenericArgs as ra_ap_rustc_type_ir[99cb08e680722369]::inherent::GenericArgs<hir_ty[5d72008b13b2c614]::next_solver::interner::DbInterner>>::identity_for_item
12: 0x55bae7619461 - <core[a6950792ababbd1]::cell::once::OnceCell<hir_ty[5d72008b13b2c614]::next_solver::generic_arg::GenericArgs>>::try_init::<<core[a6950792ababbd1]::cell::once::OnceCell<hir_ty[5d72008b13b2c614]::next_solver::generic_arg::GenericArgs>>::get_or_init<<hir_ty[5d72008b13b2c614]::infer::InferenceContext>::identity_args::{closure#0}>::{closure#0}, !>
13: 0x55bae7818fec - <hir_ty[5d72008b13b2c614]::infer::InferenceContext>::infer_closure
14: 0x55bae77fe8e1 - <hir_ty[5d72008b13b2c614]::infer::InferenceContext>::infer_expr_inner
15: 0x55bae7800184 - <hir_ty[5d72008b13b2c614]::infer::InferenceContext>::infer_expr_inner
16: 0x55bae77fe376 - <hir_ty[5d72008b13b2c614]::infer::InferenceContext>::infer_expr_inner
17: 0x55bae795d232 - hir_ty[5d72008b13b2c614]::infer::infer_query_with_inspect
18: 0x55bae784c464 - <salsa[dc22b664093bf419]::function::IngredientImpl<<hir_ty[5d72008b13b2c614]::infer::InferenceResult>::for_body::_::for_body__Configuration_>>::execute
19: 0x55bae7613c47 - <salsa[dc22b664093bf419]::attach::Attached>::attach::<dyn hir_ty[5d72008b13b2c614]::db::HirDatabase, &hir_ty[5d72008b13b2c614]::infer::InferenceResult, <hir_ty[5d72008b13b2c614]::infer::InferenceResult>::for_body::for_body_::{closure#0}>
20: 0x55bae726602c - <hir[d93e9080096ec767]::semantics::SemanticsImpl>::get_unsafe_ops
21: 0x55bae7be2113 - ide[f5854e1c26aef566]::syntax_highlighting::highlight
22: 0x55bae7c1f16e - ide[f5854e1c26aef566]::syntax_highlighting::html::highlight_as_html_with_config
23: 0x55bae7b8386c - <ide[f5854e1c26aef566]::Analysis>::highlight_as_html
24: 0x55bae8635182 - <rust_analyzer[47e7db669456c698]::cli::flags::Highlight>::run
25: 0x55bae8869354 - rust_analyzer[e832f3322db99818]::main
26: 0x55bae88655c3 - std[14b872c6dbd886e0]::sys::backtrace::__rust_begin_short_backtrace::<fn() -> core[a6950792ababbd1]::result::Result<std[14b872c6dbd886e0]::process::ExitCode, anyhow[3651e52fea1bebe0]::Error>, core[a6950792ababbd1]::result::Result<std[14b872c6dbd886e0]::process::ExitCode, anyhow[3651e52fea1bebe0]::Error>>
27: 0x55bae8867322 - std[14b872c6dbd886e0]::rt::lang_start::<core[a6950792ababbd1]::result::Result<std[14b872c6dbd886e0]::process::ExitCode, anyhow[3651e52fea1bebe0]::Error>>::{closure#0}
28: 0x7fcddb8064dd - std[14b872c6dbd886e0]::rt::lang_start_internal
29: 0x55bae887fdc8 - main
30: 0x7fcdd4e27741 - <unknown>
31: 0x7fcdd4e27879 - __libc_start_main
32: 0x55bae7163079 - <unknown>
33: 0x0 - <unknown>
rust-analyzer 1.99.0-nightly (f65b272 2026-07-21)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the panic with the provided enum snippet by running rust-analyzer highlight < code.rs. Start at crates/hir-ty/src/next_solver/generics.rs:45 and follow the generics_of and inference path shown in the stack trace. Done means the highlight command handles this input without panicking.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100