rust-lang / rust-lang/rust-analyzer
panic: `0.Named(FunctionId("two_htrb_trait_param")) is a region but value is Type(?0t)`
Open
Nobody has claimed this yet.
A-lifetimes
A-new-solver
C-bug
I-panic
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
trait Foo<'a> {
type Assoc;
}
impl Foo<'_> for () {
type Assoc = ();
}
trait Bar<'a> {
type Assoc;
}
impl<'a> Bar<'a> for () {
type Assoc = &'a ();
}
trait Qux<'a> {}
impl Qux<'_> for () {}
fn two_htrb_trait_param() -> impl for<'a> Foo<'a, Assoc = impl for<'b> Qux<'a>> {}
fn main() {}
rust-analyzer analysis-stats . --run-all-ide-things
Database loaded: 587.35ms, 229minstr, 48mb (metadata 298.51ms, 1006kinstr, 152kb; build 31.92ms, 182kinstr, 1920b)
item trees: 1
dependency lines of code: 1_467_433, item trees: 2_948
dependency item stats: traits: 848, impl: 9_686, mods: 3_059, macro calls: 5_580, macro rules: 1_054
Item Tree Collection: 4.21s, 23ginstr, 427mb
Total Statistics:
crates: 1, mods: 1, decls: 7, bodies: 2, adts: 0, consts: 0, signatures: 10, variants: 0
Workspace:
traits: 3, macro_rules macros: 0, proc_macros: 0
lines of code: 24, item trees: 1
usages: traits: 3, impl: 3, mods: 0, macro calls: 0, macro rules: 0
Dependencies:
lines of code: 1_467_433, item trees: 2_948
declarations: traits: 848, impl: 9_686, mods: 3_059, macro calls: 5_580, macro rules: 1_054
Item Collection: 2.47s, 11ginstr, 179mb
Crate lang items: 445.99ms, 2473minstr, 31mb
Expression Store Lowering: 461.30µs, 654kinstr, 12kb
0/2 0% processing: ra::two_htrb_trait_param
thread 'main' (1783588) panicked at src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/canonical/instantiate.rs:95:22:
0.Named(FunctionId("two_htrb_trait_param")) is a region but value is Type(?0t)
stack backtrace:
0: __rustc::rust_begin_unwind
1: core::panicking::panic_fmt
2: hir_ty::next_solver::infer::canonical::instantiate::instantiate_value::<hir_ty::next_solver::infer::canonical::QueryResponse<hir_ty::next_solver::ty::Ty>>::{closure#0}
3: <hir_ty::next_solver::generic_arg::GenericArg as ra_ap_rustc_type_ir::fold::TypeFoldable<hir_ty::next_solver::interner::DbInterner>>::fold_with::<hir_ty::next_solver::fold::BoundVarReplacer<hir_ty::next_solver::fold::FnMutDelegate>>
4: <hir_ty::next_solver::generic_arg::GenericArgs as ra_ap_rustc_type_ir::fold::TypeFoldable<hir_ty::next_solver::interner::DbInterner>>::fold_with::<hir_ty::next_solver::fold::BoundVarReplacer<hir_ty::next_solver::fold::FnMutDelegate>>
5: <ra_ap_rustc_type_ir::predicate_kind::ClauseKind<hir_ty::next_solver::interner::DbInterner> as ra_ap_rustc_type_ir::fold::TypeFoldable<hir_ty::next_solver::interner::DbInterner>>::fold_with::<hir_ty::next_solver::fold::BoundVarReplacer<hir_ty::next_solver::fold::FnMutDelegate>>
6: <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::<hir_ty::next_solver::fold::BoundVarReplacer<hir_ty::next_solver::fold::FnMutDelegate>>
7: <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
8: <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
9: <ra_ap_rustc_next_trait_solver::solve::eval_ctxt::EvalCtxt<hir_ty::next_solver::solver::SolverContext, hir_ty::next_solver::interner::DbInterner>>::evaluate_goal_raw
10: <ra_ap_rustc_next_trait_solver::solve::eval_ctxt::EvalCtxt<hir_ty::next_solver::solver::SolverContext, hir_ty::next_solver::interner::DbInterner>>::evaluate_goal
11: <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
12: <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
13: <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
14: <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
15: <ra_ap_rustc_next_trait_solver::solve::eval_ctxt::EvalCtxt<hir_ty::next_solver::solver::SolverContext, hir_ty::next_solver::interner::DbInterner>>::evaluate_goal_raw
16: <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
17: <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
18: <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
19: <ra_ap_rustc_next_trait_solver::solve::eval_ctxt::EvalCtxt<hir_ty::next_solver::solver::SolverContext, hir_ty::next_solver::interner::DbInterner>>::evaluate_goal_raw
20: <ra_ap_rustc_next_trait_solver::solve::eval_ctxt::EvalCtxt<hir_ty::next_solver::solver::SolverContext, hir_ty::next_solver::interner::DbInterner>>::evaluate_goal
21: <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
22: <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
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_raw
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_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
28: <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
29: <ra_ap_rustc_next_trait_solver::solve::eval_ctxt::EvalCtxt<hir_ty::next_solver::solver::SolverContext, hir_ty::next_solver::interner::DbInterner>>::evaluate_goal_raw
30: <ra_ap_rustc_next_trait_solver::solve::eval_ctxt::EvalCtxt<hir_ty::next_solver::solver::SolverContext, hir_ty::next_solver::interner::DbInterner>>::evaluate_goal
31: <hir_ty::next_solver::solver::SolverContext as ra_ap_rustc_next_trait_solver::solve::eval_ctxt::SolverDelegateEvalExt>::evaluate_root_goal
32: <hir_ty::next_solver::fulfill::FulfillmentCtxt>::try_evaluate_obligations
33: <hir_ty::next_solver::infer::at::At>::structurally_normalize_term
34: <hir_ty::infer::unify::InferenceTable>::try_structurally_resolve_type
35: hir_ty::infer::infer_query_with_inspect
36: <salsa::function::IngredientImpl<<hir_ty::infer::InferenceResult>::for_body::_::for_body__Configuration_>>::execute
37: <salsa::attach::Attached>::attach::<dyn hir_ty::db::HirDatabase, &hir_ty::infer::InferenceResult, <hir_ty::infer::InferenceResult>::for_body::for_body_::{closure#0}>
38: <rust_analyzer::cli::flags::AnalysisStats>::run_inference
39: <rust_analyzer::cli::flags::AnalysisStats>::run::{closure#3}
40: <rust_analyzer::cli::flags::AnalysisStats>::run
41: rust_analyzer::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
infer panicked for ra::two_htrb_trait_param: 0.Named(FunctionId("two_htrb_trait_param")) is a region but value is Type(?0t)
exprs: 1, ??ty: 0 (0%), ?ty: 0 (0%), !ty: 0
pats: 0, ??ty: 0 (100%), ?ty: 0 (100%), !ty: 0
panics: 1
Inference: 24.23ms, 63minstr, 7mb
1/2 50% mir lowering: ra::two_htrb_trait_param2026-07-29T18:30:14.728357633+02:00 WARN Propagating panic for cycle head that panicked in an earlier execution in that revision
rust-analyzer 1.99.0-nightly (26ae60a 2026-07-28)
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
Start by reproducing the panic with rust-analyzer analysis-stats . --run-all-ide-things using the Rust example in the issue. Then inspect src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/canonical/instantiate.rs around line 95 and trace the canonical instantiation path. Done means the example no longer panics during analysis.
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
- Mostly clear
- Newbie friendliness
- 48/100