rust-lang/chalk

unimplemented macro calls are crashing rust-analyzer

Closed this issue · 0 comments

I've seen a lot of panics coming from rust-analyzer that stem from one of these two unimplemented macro calls:

TypeName::OpaqueType(_) => unimplemented!(),
TypeName::AssociatedType(_) => unimplemented!(),

The backtrace points to

pub fn push_auto_trait_impls<I: Interner>(
but it calls the function linked above, which is likely inlined.

Click to expand backtrace
thread '<unnamed>' panicked at 'not implemented', /rustc/04488afe34512aa4c33566eb16d8c912a3ae04f9/src/libstd/macros.rs:13:23
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1076
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1537
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:198
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:217
  10: std::thread::local::LocalKey<T>::with
  11: stdx::panic_context::PanicContext::init::{{closure}}
  12: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:530
  13: std::panicking::begin_panic
  14: chalk_solve::clauses::push_auto_trait_impls
  15: chalk_solve::clauses::builder::ClauseBuilder<I>::push_binders
  16: chalk_solve::clauses::program_clauses_that_could_match
  17: chalk_solve::clauses::program_clauses_for_goal
  18: <chalk_recursive::recursive::Solver<I> as chalk_recursive::solve::SolveDatabase<I>>::solve_goal
  19: <chalk_recursive::recursive::RecursiveSolver<I> as chalk_solve::solve::Solver<I>>::solve_limited
  20: hir_ty::traits::trait_solve_query
  21: salsa::runtime::Runtime::execute_query_implementation
  22: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  23: salsa::derived::slot::Slot<Q,MP>::read
  24: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  25: salsa::QueryTable<Q>::get
  26: <DB as hir_ty::db::HirDatabase>::trait_solve::__shim
  27: <DB as hir_ty::db::HirDatabase>::trait_solve
  28: hir_ty::infer::InferenceContext::resolve_ty_as_possible
  29: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_coerce
  30: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::check_call_arguments
  31: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
  32: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr
  33: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_method_call
  34: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
  35: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr
  36: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
  37: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_coerce
  38: hir_ty::infer::infer_query
  39: salsa::runtime::Runtime::execute_query_implementation
  40: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  41: salsa::derived::slot::Slot<Q,MP>::read
  42: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  43: <DB as hir_ty::db::HirDatabase>::infer_query::__shim
  44: hir_ty::db::infer_wait
  45: hir::source_analyzer::SourceAnalyzer::new_for_body
  46: hir::semantics::SemanticsImpl::analyze2
  47: hir::semantics::SemanticsImpl::descend_into_macros
  48: ide::hover::hover
  49: ide::Analysis::hover
  50: rust_analyzer::handlers::handle_hover
  51: <F as threadpool::FnBox>::call_box
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.