Closed
Description
On some elements in my code base, running "Find all references" causes a panic with the following message:
Panic context:
>
version: d15f646ff 2021-08-30 stable
request: textDocument/references ReferenceParams {
text_document_position: TextDocumentPositionParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "redacted.rs",
query: None,
fragment: None,
},
},
position: Position {
line: 368,
character: 21,
},
},
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
partial_result_params: PartialResultParams {
partial_result_token: None,
},
context: ReferenceContext {
include_declaration: true,
},
}
thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 1', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/chalk-ir-0.70.0/src/lib.rs:2752:10
stack backtrace:
0: _rust_begin_unwind
1: core::panicking::panic_fmt
2: core::panicking::panic_bounds_check
3: <&chalk_ir::SubstFolder<I,A> as chalk_ir::fold::Folder<I>>::fold_free_var_ty
4: <chalk_ir::Ty<I> as chalk_ir::fold::SuperFold<I>>::super_fold_with
5: <chalk_ir::Ty<I> as chalk_ir::fold::SuperFold<I>>::super_fold_with
6: <chalk_ir::Ty<I> as chalk_ir::fold::SuperFold<I>>::super_fold_with
7: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_method_call
8: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
9: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::check_call_arguments
10: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
11: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_coerce
12: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_block
13: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
14: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_coerce
15: hir_ty::infer::infer_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>::infer_query
21: hir_ty::db::infer_wait
22: hir::source_analyzer::SourceAnalyzer::new_for_body
23: hir::semantics::SemanticsImpl::analyze_impl
24: hir::semantics::SemanticsImpl::descend_into_macros
25: rowan::utility_types::TokenAtOffset<T>::map
26: ide_db::search::FindUsages::search
27: ide::references::find_all_refs
28: std::panicking::try
29: rust_analyzer::handlers::handle_references
30: rust_analyzer::dispatch::RequestDispatcher::on::{{closure}}::{{closure}}
31: <F as threadpool::FnBox>::call_box
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 1:14:23 PM] Request textDocument/references failed.
Message: server panicked: index out of bounds: the len is 1 but the index is 1
Code: -32603
Unfortunately, this is a fairly complicated internal project, so I can't find a minimal reproduction or share the code itself 🙁 That said, one thing I noticed is that this works on an older version of R-A (0.2.702), but started failing on the release after that.