rust-lang / rust-lang/rust-analyzer
panic: `!source_term.clone().has_escaping_bound_vars()`
Open
Nobody has claimed this yet.
A-lifetimes
C-bug
I-panic
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
struct X;
trait Trait {
fn foo<'a, const N: &'a X = isize>() {}
}
~/.rustup/toolchains/master/bin/rust-analyzer highlight < code.rs
thread 'main' (1323284) panicked at src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/relate/generalize.rs:231:9:
assertion failed: !source_term.clone().has_escaping_bound_vars()
stack backtrace:
0: 0x7fe870c2a3a6 - <<std[1982baa743927e99]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[f465834d8a4f5c90]::fmt::Display>::fmt
1: 0x7fe87120d912 - core[f465834d8a4f5c90]::fmt::write
2: 0x7fe870c3f4fc - <std[1982baa743927e99]::sys::stdio::unix::Stderr as core[f465834d8a4f5c90]::io::write::Write>::write_fmt
3: 0x7fe870bfbfda - std[1982baa743927e99]::panicking::default_hook::{closure#0}
4: 0x7fe870c1ca43 - std[1982baa743927e99]::panicking::default_hook
5: 0x7fe870c1ceab - std[1982baa743927e99]::panicking::panic_with_hook
6: 0x7fe870bfc0c4 - std[1982baa743927e99]::panicking::panic_handler::{closure#0}
7: 0x7fe870bf2a29 - std[1982baa743927e99]::sys::backtrace::__rust_end_short_backtrace::<std[1982baa743927e99]::panicking::panic_handler::{closure#0}, !>
8: 0x7fe870bfd9ed - __rustc[163072274320cfb5]::rust_begin_unwind
9: 0x7fe86d6deafc - core[f465834d8a4f5c90]::panicking::panic_fmt
10: 0x7fe86de7bcf2 - core[f465834d8a4f5c90]::panicking::panic
11: 0x563b061e1cd5 - <hir_ty[26e24694bccb7328]::next_solver::infer::InferCtxt>::instantiate_ty_var::<ra_ap_rustc_type_ir[2d2ad0764abf9d15]::relate::solver_relating::SolverRelating<hir_ty[26e24694bccb7328]::next_solver::infer::InferCtxt, hir_ty[26e24694bccb7328]::next_solver::interner::DbInterner>>
12: 0x563b065a0d01 - <ra_ap_rustc_type_ir[2d2ad0764abf9d15]::relate::solver_relating::SolverRelating<hir_ty[26e24694bccb7328]::next_solver::infer::InferCtxt, hir_ty[26e24694bccb7328]::next_solver::interner::DbInterner> as ra_ap_rustc_type_ir[2d2ad0764abf9d15]::relate::TypeRelation<hir_ty[26e24694bccb7328]::next_solver::interner::DbInterner>>::tys
13: 0x563b062ffe45 - <hir_ty[26e24694bccb7328]::next_solver::infer::InferCtxt as ra_ap_rustc_type_ir[2d2ad0764abf9d15]::relate::solver_relating::RelateExt>::relate::<hir_ty[26e24694bccb7328]::next_solver::ty::Ty>
14: 0x563b064caf7c - <hir_ty[26e24694bccb7328]::infer::InferenceContext>::demand_eqtype
15: 0x563b0640e8de - <salsa[4a2c27948d016988]::function::IngredientImpl<<hir_ty[26e24694bccb7328]::infer::InferenceResult>::for_anon_const::_::for_anon_const__Configuration_>>::execute
16: 0x563b063eb112 - <salsa[4a2c27948d016988]::function::IngredientImpl<<hir_ty[26e24694bccb7328]::infer::InferenceResult>::for_anon_const::_::for_anon_const__Configuration_>>::fetch
17: 0x563b061fec8c - <std[1982baa743927e99]::thread::local::LocalKey<salsa[4a2c27948d016988]::attach::Attached>>::with::<salsa[4a2c27948d016988]::attach::attach<&hir_ty[26e24694bccb7328]::infer::InferenceResult, dyn hir_ty[26e24694bccb7328]::db::HirDatabase, <hir_ty[26e24694bccb7328]::infer::InferenceResult>::for_anon_const::for_anon_const_::{closure#0}>::{closure#0}, &hir_ty[26e24694bccb7328]::infer::InferenceResult>
18: 0x563b05e06a53 - <hir[7ad85eaab5b2b40e]::source_analyzer::SourceAnalyzer>::new_generic_def_
19: 0x563b05e28596 - <hir[7ad85eaab5b2b40e]::semantics::SemanticsImpl>::analyze_impl
20: 0x563b05e3a147 - <hir[7ad85eaab5b2b40e]::semantics::SemanticsImpl>::resolve_path_with_subst
21: 0x563b06c42070 - <ide_db[4c988ca8a3b6339d]::defs::NameRefClass>::classify
22: 0x563b067a6d0f - ide[30ad0f08913b17a1]::syntax_highlighting::highlight
23: 0x563b067e14ce - ide[30ad0f08913b17a1]::syntax_highlighting::html::highlight_as_html_with_config
24: 0x563b06747e9c - <ide[30ad0f08913b17a1]::Analysis>::highlight_as_html
25: 0x563b071f9dc2 - <rust_analyzer[36ea474561c7f7a2]::cli::flags::Highlight>::run
26: 0x563b0742e1d4 - rust_analyzer[fad7725dce625749]::main
27: 0x563b0742a443 - std[1982baa743927e99]::sys::backtrace::__rust_begin_short_backtrace::<fn() -> core[f465834d8a4f5c90]::result::Result<std[1982baa743927e99]::process::ExitCode, anyhow[20561770c327b098]::Error>, core[f465834d8a4f5c90]::result::Result<std[1982baa743927e99]::process::ExitCode, anyhow[20561770c327b098]::Error>>
28: 0x563b0742c1a2 - std[1982baa743927e99]::rt::lang_start::<core[f465834d8a4f5c90]::result::Result<std[1982baa743927e99]::process::ExitCode, anyhow[20561770c327b098]::Error>>::{closure#0}
29: 0x7fe87241b513 - std[1982baa743927e99]::rt::lang_start_internal
30: 0x563b07444c68 - main
31: 0x7fe86ba27741 - <unknown>
32: 0x7fe86ba27879 - __libc_start_main
33: 0x563b05d27699 - <unknown>
34: 0x0 - <unknown>
rust-analyzer 1.99.0-nightly (c188565 2026-07-22)
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 reported Rust snippet and the rust-analyzer highlight < code.rs command. Start at crates/hir-ty/src/next_solver/infer/relate/generalize.rs:231, then trace the highlighted type-inference path; done means the command no longer panics for this input.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100