Stream: t-compiler/rust-analyzer

Topic: Chalk panic


Paul Faria (Oct 05 2020 at 20:09, on Zulip):

I'm seeing panics in chalk due to unimplemeted!() macros being hit. This is causing RA to crash. Is it expected that chalk is publishing with unimplemented calls? I would imagine it should continue rather than completely panic, that unimplemented would be something left in for debugging, but wanted to check here before filing a bug in chalk. Cc @matklad @Jonas Schievink

Jonas Schievink [he/him] (Oct 05 2020 at 20:11, on Zulip):

Can you post a backtrace?

Paul Faria (Oct 05 2020 at 20:14, on Zulip):

The panic is happening somewhere around here https://github.com/rust-lang/chalk/blob/8f2805620b6928ad76aab3f11b322ad0771c7cbe/chalk-solve/src/clauses.rs#L80 but it's hard to tell exactly because it's inlined inside of https://github.com/rust-lang/chalk/blob/8f2805620b6928ad76aab3f11b322ad0771c7cbe/chalk-solve/src/clauses.rs#L117 in my backtrace

Paul Faria (Oct 05 2020 at 20:17, on Zulip):
Panic context:

> request: textDocument/hover HoverParams {

text_document_position_params: TextDocumentPositionParams {

text_document: TextDocumentIdentifier {

uri: "<stripped>",

},

position: Position {

line: 49,

character: 24,

},

},

work_done_progress_params: WorkDoneProgressParams {

work_done_token: None,

},

}


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.
Paul Faria (Oct 05 2020 at 20:18, on Zulip):

The stripped url was something I did because I'm not sure if I'm allowed to share work machine paths

woody77 (Oct 05 2020 at 20:22, on Zulip):

full backtrace:

thread '<unnamed>' panicked at 'not implemented', /Users/aaronwood/.cargo/registry/src/github.com-1ecc6299db9ec823/chalk-solve-0.30.0/src/clauses.rs:60:40
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::fulfill::Fulfill<I,Solver,Infer>::prove
   7: chalk_recursive::fulfill::Fulfill<I,Solver,Infer>::solve
   8: chalk_recursive::recursive::Solver<I>::solve_new_subgoal
   9: <chalk_recursive::recursive::Solver<I> as chalk_recursive::solve::SolveDatabase<I>>::solve_goal
  10: chalk_recursive::fulfill::Fulfill<I,Solver,Infer>::prove
  11: chalk_recursive::fulfill::Fulfill<I,Solver,Infer>::solve
  12: chalk_recursive::recursive::Solver<I>::solve_new_subgoal
  13: <chalk_recursive::recursive::Solver<I> as chalk_recursive::solve::SolveDatabase<I>>::solve_goal
  14: <chalk_recursive::recursive::RecursiveSolver<I> as chalk_solve::solve::Solver<I>>::solve_limited
  15: hir_ty::traits::trait_solve_query
  16: salsa::runtime::Runtime::execute_query_implementation
  17: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  18: salsa::derived::slot::Slot<Q,MP>::read
  19: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  20: <DB as hir_ty::db::HirDatabase>::trait_solve::__shim
  21: <DB as hir_ty::db::HirDatabase>::trait_solve
  22: hir_ty::infer::InferenceContext::resolve_ty_as_possible
  23: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_coerce
  24: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::check_call_arguments
  25: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
  26: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_coerce
  27: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::check_call_arguments
  28: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
  29: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_coerce
  30: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
  31: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr
  32: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
  33: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
  34: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_coerce
  35: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
  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::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
  39: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_coerce
  40: hir_ty::infer::infer_query
  41: salsa::runtime::Runtime::execute_query_implementation
  42: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  43: salsa::derived::slot::Slot<Q,MP>::read
  44: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  45: <DB as hir_ty::db::HirDatabase>::infer_query::__shim
  46: hir_ty::db::infer_wait
  47: hir::source_analyzer::SourceAnalyzer::new_for_body
  48: hir::semantics::SemanticsImpl::analyze2
  49: hir::semantics::SemanticsImpl::type_of_pat
  50: ide::inlay_hints::inlay_hints
  51: std::panicking::try
  52: ide::Analysis::inlay_hints
  53: rust_analyzer::handlers::handle_inlay_hints
  54: <F as threadpool::FnBox>::call_box
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Panic context:
> request: rust-analyzer/inlayHints InlayHintsParams {
    text_document: TextDocumentIdentifier {
        uri: "file:///[omitted by aaronwood@]",
    },
}
Jack Huey (Oct 05 2020 at 20:28, on Zulip):

eek yeah we probably should have not done that

Jack Huey (Oct 05 2020 at 20:32, on Zulip):

Should be a super simple fix

Paul Faria (Oct 05 2020 at 21:50, on Zulip):

Forgot to follow up. I should file a bug against chalk, right?

Paul Faria (Oct 05 2020 at 21:59, on Zulip):

Filed https://github.com/rust-lang/chalk/issues/621

Jack Huey (Oct 05 2020 at 22:24, on Zulip):

chalk#622

Last update: Jul 26 2021 at 12:30UTC