rust-analyzer/rust-analyzer.github.io

Rust-analyzer panics in chalk_solve::clauses::push_auto_trait_impls

bdonlan opened this issue · 3 comments

I've been seeing panics like the following, resulting in quick fix and inlay hints breaking, among other things:

thread '<unnamed>' panicked at 'not implemented', /home/bdonlan/.cargo/registry/src/github.com-1ecc6299db9ec823/chalk-solve-0.30.0/src/clauses.rs:59:36
stack backtrace:
   0: std::panicking::begin_panic
   1: chalk_solve::clauses::push_auto_trait_impls
   2: chalk_solve::clauses::builder::ClauseBuilder<I>::push_binders
   3: chalk_solve::clauses::program_clauses_for_goal
   4: chalk_recursive::recursive::Solver<I>::solve_new_subgoal
   5: <chalk_recursive::recursive::Solver<I> as chalk_recursive::solve::SolveDatabase<I>>::solve_goal
   6: <chalk_recursive::recursive::RecursiveSolver<I> as chalk_solve::solve::Solver<I>>::solve_limited
   7: hir_ty::traits::trait_solve_query
   8: salsa::runtime::Runtime::execute_query_implementation
   9: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  10: salsa::derived::slot::Slot<Q,MP>::read
  11: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  12: <DB as hir_ty::db::HirDatabase>::trait_solve::__shim
  13: <DB as hir_ty::db::HirDatabase>::trait_solve
  14: hir_ty::infer::InferenceContext::resolve_ty_as_possible
  15: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_coerce
  16: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::check_call_arguments
  17: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_method_call
  18: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
  19: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
  20: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
  21: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_coerce
  22: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
  23: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_coerce
  24: hir_ty::infer::infer_query
  25: salsa::runtime::Runtime::execute_query_implementation
  26: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  27: salsa::derived::slot::Slot<Q,MP>::read
  28: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  29: <DB as hir_ty::db::HirDatabase>::infer_query::__shim
  30: hir_ty::db::infer_wait
  31: hir::source_analyzer::SourceAnalyzer::new_for_body
  32: hir::semantics::SemanticsImpl::analyze2
  33: hir::semantics::SemanticsImpl::type_of_pat
  34: ide::inlay_hints::inlay_hints
  35: std::panicking::try
  36: ide::Analysis::inlay_hints
  37: rust_analyzer::handlers::handle_inlay_hints
  38: <F as threadpool::FnBox>::call_box
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

It looks at first glance like updating chalk to 0.32.0 might fix this, but it's a bit nontrivial as there are some incompatible changes to traits that were made as well.

Unfortunately I've not had much success in producing an isolated test case that I can share yet. I can reproduce for testing on my side however.

Oops, wrong repo, will refile.

@bdonlan that's already fixed in the nightly version, see rust-lang/rust-analyzer#6134.