thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 1', crates/hir_def/src/nameres/path_resolution.rs:385:33
[ERROR project_model::workspace] cyclic deps: rustc_std_workspace_core(CrateId(1187)) -> core(CrateId(188)), alternative path: core(CrateId(188)) -> rand(CrateId(1055)) -> getrandom(CrateId(529)) -> cfg_if(CrateId(147)) -> compiler_builtins(CrateId(181)) -> rustc_std_workspace_core(CrateId(1187))
[Info - 11:51:32] Connection to server got closed. Server will restart.
[ERROR project_model::workspace] cyclic deps: rustc_std_workspace_core(CrateId(1187)) -> core(CrateId(188)), alternative path: core(CrateId(188)) -> rand(CrateId(1055)) -> getrandom(CrateId(529)) -> cfg_if(CrateId(147)) -> compiler_builtins(CrateId(181)) -> rustc_std_workspace_core(CrateId(1187))
[ERROR project_model::workspace] cyclic deps: rustc_std_workspace_core(CrateId(1187)) -> core(CrateId(188)), alternative path: core(CrateId(188)) -> rand(CrateId(1055)) -> getrandom(CrateId(529)) -> cfg_if(CrateId(147)) -> compiler_builtins(CrateId(181)) -> rustc_std_workspace_core(CrateId(1187))
[ERROR project_model::workspace] cyclic deps: rustc_std_workspace_core(CrateId(1187)) -> core(CrateId(188)), alternative path: core(CrateId(188)) -> rand(CrateId(1055)) -> getrandom(CrateId(529)) -> cfg_if(CrateId(147)) -> compiler_builtins(CrateId(181)) -> rustc_std_workspace_core(CrateId(1187))
[ERROR project_model::workspace] cyclic deps: rustc_std_workspace_core(CrateId(1187)) -> core(CrateId(188)), alternative path: core(CrateId(188)) -> rand(CrateId(1055)) -> getrandom(CrateId(529)) -> cfg_if(CrateId(147)) -> compiler_builtins(CrateId(181)) -> rustc_std_workspace_core(CrateId(1187))
[ERROR project_model::workspace] cyclic deps: rustc_std_workspace_core(CrateId(1187)) -> core(CrateId(188)), alternative path: core(CrateId(188)) -> rand(CrateId(1055)) -> getrandom(CrateId(529)) -> cfg_if(CrateId(147)) -> compiler_builtins(CrateId(181)) -> rustc_std_workspace_core(CrateId(1187))
[ERROR project_model::workspace] cyclic deps: rustc_std_workspace_core(CrateId(1187)) -> core(CrateId(188)), alternative path: core(CrateId(188)) -> rand(CrateId(1055)) -> getrandom(CrateId(529)) -> cfg_if(CrateId(147)) -> compiler_builtins(CrateId(181)) -> rustc_std_workspace_core(CrateId(1187))
[ERROR project_model::workspace] cyclic deps: rustc_std_workspace_core(CrateId(1187)) -> core(CrateId(188)), alternative path: core(CrateId(188)) -> rand(CrateId(1055)) -> getrandom(CrateId(529)) -> cfg_if(CrateId(147)) -> compiler_builtins(CrateId(181)) -> rustc_std_workspace_core(CrateId(1187))
[ERROR project_model::workspace] cyclic deps: rustc_std_workspace_core(CrateId(1187)) -> core(CrateId(188)), alternative path: core(CrateId(188)) -> rand(CrateId(1055)) -> getrandom(CrateId(529)) -> cfg_if(CrateId(147)) -> compiler_builtins(CrateId(181)) -> rustc_std_workspace_core(CrateId(1187))
[ERROR project_model::workspace] cyclic deps: rustc_std_workspace_core(CrateId(1187)) -> core(CrateId(188)), alternative path: core(CrateId(188)) -> rand(CrateId(1055)) -> getrandom(CrateId(529)) -> cfg_if(CrateId(147)) -> compiler_builtins(CrateId(181)) -> rustc_std_workspace_core(CrateId(1187))
[ERROR project_model::workspace] cyclic deps: rustc_std_workspace_core(CrateId(1187)) -> core(CrateId(188)), alternative path: core(CrateId(188)) -> rand(CrateId(1055)) -> getrandom(CrateId(529)) -> cfg_if(CrateId(147)) -> compiler_builtins(CrateId(181)) -> rustc_std_workspace_core(CrateId(1187))
[ERROR project_model::workspace] cyclic deps: rustc_std_workspace_core(CrateId(1187)) -> core(CrateId(188)), alternative path: core(CrateId(188)) -> rand(CrateId(1055)) -> getrandom(CrateId(529)) -> cfg_if(CrateId(147)) -> compiler_builtins(CrateId(181)) -> rustc_std_workspace_core(CrateId(1187))
[ERROR project_model::workspace] cyclic deps: rustc_std_workspace_core(CrateId(1187)) -> core(CrateId(188)), alternative path: core(CrateId(188)) -> rand(CrateId(1055)) -> getrandom(CrateId(529)) -> cfg_if(CrateId(147)) -> compiler_builtins(CrateId(181)) -> rustc_std_workspace_core(CrateId(1187))
[ERROR project_model::workspace] cyclic deps: rustc_std_workspace_core(CrateId(1187)) -> core(CrateId(188)), alternative path: core(CrateId(188)) -> rand(CrateId(1055)) -> getrandom(CrateId(529)) -> cfg_if(CrateId(147)) -> compiler_builtins(CrateId(181)) -> rustc_std_workspace_core(CrateId(1187))
[ERROR project_model::workspace] cyclic deps: rustc_std_workspace_core(CrateId(1187)) -> core(CrateId(188)), alternative path: core(CrateId(188)) -> rand(CrateId(1055)) -> getrandom(CrateId(529)) -> cfg_if(CrateId(147)) -> compiler_builtins(CrateId(181)) -> rustc_std_workspace_core(CrateId(1187))
[ERROR project_model::workspace] cyclic deps: rustc_std_workspace_core(CrateId(1187)) -> core(CrateId(188)), alternative path: core(CrateId(188)) -> rand(CrateId(1055)) -> getrandom(CrateId(529)) -> cfg_if(CrateId(147)) -> compiler_builtins(CrateId(181)) -> rustc_std_workspace_core(CrateId(1187))
[ERROR project_model::workspace] cyclic deps: rustc_std_workspace_core(CrateId(1187)) -> core(CrateId(188)), alternative path: core(CrateId(188)) -> rand(CrateId(1055)) -> getrandom(CrateId(529)) -> cfg_if(CrateId(147)) -> compiler_builtins(CrateId(181)) -> rustc_std_workspace_core(CrateId(1187))
[ERROR project_model::workspace] cyclic deps: rustc_std_workspace_core(CrateId(1187)) -> core(CrateId(188)), alternative path: core(CrateId(188)) -> rand(CrateId(1055)) -> getrandom(CrateId(529)) -> cfg_if(CrateId(147)) -> compiler_builtins(CrateId(181)) -> rustc_std_workspace_core(CrateId(1187))
[ERROR project_model::workspace] cyclic deps: rustc_std_workspace_core(CrateId(1187)) -> core(CrateId(188)), alternative path: core(CrateId(188)) -> rand(CrateId(1055)) -> getrandom(CrateId(529)) -> cfg_if(CrateId(147)) -> compiler_builtins(CrateId(181)) -> rustc_std_workspace_core(CrateId(1187))
[ERROR project_model::workspace] cyclic deps: rustc_std_workspace_core(CrateId(1187)) -> core(CrateId(188)), alternative path: core(CrateId(188)) -> rand(CrateId(1055)) -> getrandom(CrateId(529)) -> cfg_if(CrateId(147)) -> compiler_builtins(CrateId(181)) -> rustc_std_workspace_core(CrateId(1187))
[ERROR project_model::workspace] cyclic deps: rustc_std_workspace_core(CrateId(1187)) -> core(CrateId(188)), alternative path: core(CrateId(188)) -> rand(CrateId(1055)) -> getrandom(CrateId(529)) -> cfg_if(CrateId(147)) -> compiler_builtins(CrateId(181)) -> rustc_std_workspace_core(CrateId(1187))
[ERROR project_model::workspace] cyclic deps: rustc_std_workspace_core(CrateId(1187)) -> core(CrateId(188)), alternative path: core(CrateId(188)) -> rand(CrateId(1055)) -> getrandom(CrateId(529)) -> cfg_if(CrateId(147)) -> compiler_builtins(CrateId(181)) -> rustc_std_workspace_core(CrateId(1187))
Panic context:
>
version: d15f646ff 2021-08-30 stable
request: textDocument/hover HoverParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "/home/bjorn/Projects/rust/compiler/rustc_hir_pretty/src/lib.rs",
query: None,
fragment: None,
},
},
position: Position(
Position {
line: 83,
character: 16,
},
),
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
}
thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 1', crates/hir_def/src/nameres/path_resolution.rs:385:33
stack backtrace:
0: rust_begin_unwind
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/panicking.rs:515:5
1: core::panicking::panic_fmt
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:92:14
2: core::panicking::panic_bounds_check
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:69:5
3: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro_single
4: hir_def::resolver::Resolver::resolve_path_in_type_ns
5: hir_ty::lower::TyLoweringContext::lower_trait_ref_from_path
6: hir_ty::lower::impl_trait_query
7: salsa::runtime::Runtime::execute_query_implementation
8: salsa::derived::slot::Slot<Q,MP>::read_upgrade
9: salsa::derived::slot::Slot<Q,MP>::maybe_changed_since
10: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::maybe_changed_since
11: salsa::derived::slot::MemoRevisions::validate_memoized_value
12: salsa::derived::slot::Slot<Q,MP>::read_upgrade
13: salsa::derived::slot::Slot<Q,MP>::read
14: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
15: <DB as hir_ty::db::HirDatabase>::trait_impls_in_crate
16: hir::Impl::all_for_type
17: ide::goto_implementation::goto_implementation
18: std::panicking::try
19: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
20: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
21: rust_analyzer::handlers::handle_hover
22: rust_analyzer::dispatch::RequestDispatcher::on::{{closure}}::{{closure}}
23: <F as threadpool::FnBox>::call_box
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 12:20:13] Request textDocument/hover failed.
Message: server panicked: index out of bounds: the len is 1 but the index is 1
Code: -32603
According to the trace, this occurred when hovering over the pp::$0Printer part of this line:
https://github.com/rust-lang/rust/blob/13edc17f65bcad7fe9046720a16fc192e810970e/compiler/rustc_hir_pretty/src/lib.rs#L83
That doesn't trigger the panic for me, so there might be local changes that shift the line/column numbers around
I suspect I was replacing ast::Attribute with ast::MetaItem.
@jonas-schievink can we write a better assertion message here? Or maybe add something else to the panic context?
On a meta level, I don't think we will be very successful at reproducing the exact panics the user sees, as that needs in-memory state of the documents, and also the ability to cargo metadata the overall project.
That being said, with our current architecture, I don't think it would be too too hard to add something which dumps all salsa inputs at the moment of the panic into a ~100mb file which gives us a repro. I don't think we should do that due to the privacy concerts though.
So, I'd love us to really be able to look at the panic message, and be able to reverse-engineer the failing input, like in #10083.
I've opened https://github.com/rust-analyzer/rust-analyzer/pull/10095 to add more debugging info here
Just got this same panic today, in the middle of writing some fairly innocuous code. Something along the lines of Blah<Future = BoxFuture<.... Cleaning and restarting server didn't fix it. Deleted that line of code, everything worked. For some reason it's really not liking this BoxFuture, panics every time I put it back.
Side note: shout out to all the contributors, y'all have done a fabulous job, first stability problem in a long time, and tool is really fantastic.
Panic context:
>
version: 996300f4a 2021-08-23 stable
request: textDocument/codeAction CodeActionParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "/home/starkat99/Projects/vapor/src/http/error.rs",
query: None,
fragment: None,
},
},
range: Range {
start: Position {
line: 163,
character: 80,
},
end: Position {
line: 163,
character: 80,
},
},
context: CodeActionContext {
diagnostics: [],
only: None,
},
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
partial_result_params: PartialResultParams {
partial_result_token: None,
},
}
thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 1', /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/chalk-ir-0.70.0/src/lib.rs:2752:10
stack backtrace:
0: rust_begin_unwind
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/panicking.rs:515:5
1: core::panicking::panic_fmt
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:92:14
2: core::panicking::panic_bounds_check
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:69:5
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::_::<impl chalk_ir::fold::Fold<I> for chalk_ir::WhereClause<I>>::fold_with
6: chalk_ir::fold::binder_impls::<impl chalk_ir::fold::Fold<I> for chalk_ir::Binders<T>>::fold_with
7: <chalk_ir::cast::Casted<IT,U> as core::iter::traits::iterator::Iterator>::next
8: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
9: <hir_ty::interner::Interner as chalk_ir::interner::Interner>::intern_quantified_where_clauses
10: chalk_ir::fold::boring_impls::<impl chalk_ir::fold::Fold<I> for chalk_ir::QuantifiedWhereClauses<I>>::fold_with
11: chalk_ir::_::<impl chalk_ir::fold::Fold<I> for chalk_ir::DynTy<I>>::fold_with
12: <chalk_ir::Ty<I> as chalk_ir::fold::SuperFold<I>>::super_fold_with
13: chalk_ir::fold::boring_impls::<impl chalk_ir::fold::Fold<I> for chalk_ir::GenericArg<I>>::fold_with
14: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend
15: chalk_ir::fold::boring_impls::<impl chalk_ir::fold::Fold<I> for chalk_ir::Substitution<I>>::fold_with
16: chalk_ir::_::<impl chalk_ir::fold::Fold<I> for chalk_ir::WhereClause<I>>::fold_with
17: chalk_ir::_::<impl chalk_ir::fold::Fold<I> for chalk_ir::DomainGoal<I>>::fold_with
18: chalk_ir::_::<impl chalk_ir::fold::Fold<I> for chalk_ir::ProgramClauseImplication<I>>::fold_with
19: chalk_solve::infer::instantiate::<impl chalk_solve::infer::InferenceTable<I>>::instantiate_binders_existentially
20: chalk_recursive::fulfill::Fulfill<I,Solver>::new_with_clause
21: chalk_recursive::solve::SolveIteration::solve_iteration
22: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
23: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_root_goal
24: hir_ty::traits::trait_solve_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>::trait_solve_query::__shim
30: <DB as hir_ty::db::HirDatabase>::trait_solve_query
31: hir_ty::db::trait_solve_wait
32: <DB as hir_ty::db::HirDatabase>::trait_solve
33: hir_ty::method_resolution::iterate_trait_method_candidates
34: hir_ty::method_resolution::iterate_method_candidates_by_receiver
35: hir_ty::method_resolution::iterate_method_candidates_impl
36: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_method_call
37: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
38: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr
39: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_block
40: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
41: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr
42: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
43: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr
44: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_block
45: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
46: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_coerce
47: hir_ty::infer::infer_query
48: salsa::runtime::Runtime::execute_query_implementation
49: salsa::derived::slot::Slot<Q,MP>::read_upgrade
50: salsa::derived::slot::Slot<Q,MP>::read
51: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
52: <DB as hir_ty::db::HirDatabase>::infer_query
53: hir_ty::db::infer_wait
54: hir::Function::diagnostics
55: hir::Module::diagnostics
56: ide_diagnostics::diagnostics
57: ide::Analysis::assists_with_fixes::{{closure}}
58: std::panicking::try
59: rust_analyzer::handlers::handle_code_action
60: rust_analyzer::dispatch::RequestDispatcher::on::{{closure}}::{{closure}}
61: <F as threadpool::FnBox>::call_box
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
@starkat99 that looks like https://github.com/rust-analyzer/rust-analyzer/issues/10046
Just ran into this while hacking on salsa:
Panic context:
>
version: 726f34cb4 2021-09-03 dev
request: textDocument/hover HoverParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "/home/jonas/dev/salsa/tests/on_demand_inputs.rs",
query: None,
fragment: None,
},
},
position: Position(
Position {
line: 24,
character: 26,
},
),
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
}
> DefMap CrateId(153) None path Ident
thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 3', crates/hir_def/src/nameres/path_resolution.rs:394:33
And managed to reproduce this once by hovering over Ident here, but a subsequent server restart made it no longer reproduce...
I have no idea why hovering over anything in on_demand_inputs.rs would make us try to resolve Ident though.
I'm currently getting this error a bunch with RA Nightly. Here's a dump of all the output in the VSCode output panel:
Panic context:
>
version: 5506e0dfa 2021-09-04 nightly
request: textDocument/hover HoverParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "/home/jplatte/code/ruma/crates/ruma-state-res/src/state_event.rs",
query: None,
fragment: None,
},
},
position: Position(
Position {
line: 29,
character: 33,
},
),
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
}
> DefMap CrateId(1069) None path Registry
thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 1', crates/hir_def/src/nameres/path_resolution.rs:394:33
stack backtrace:
0: rust_begin_unwind
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/panicking.rs:515:5
1: core::panicking::panic_fmt
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:92:14
2: core::panicking::panic_bounds_check
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:69:5
3: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro_single
4: hir_def::resolver::Resolver::resolve_path_in_type_ns
5: hir_ty::lower::TyLoweringContext::lower_ty_ext
6: hir_ty::lower::impl_self_ty_query
7: salsa::runtime::Runtime::execute_query_implementation
8: salsa::derived::slot::Slot<Q,MP>::read_upgrade
9: salsa::derived::slot::Slot<Q,MP>::read
10: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
11: <DB as hir_ty::db::HirDatabase>::impl_self_ty
12: hir_ty::lower::impl_trait_query
13: salsa::runtime::Runtime::execute_query_implementation
14: salsa::derived::slot::Slot<Q,MP>::read_upgrade
15: salsa::derived::slot::Slot<Q,MP>::maybe_changed_since
16: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::maybe_changed_since
17: salsa::derived::slot::MemoRevisions::validate_memoized_value
18: salsa::derived::slot::Slot<Q,MP>::read_upgrade
19: salsa::derived::slot::Slot<Q,MP>::read
20: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
21: <DB as hir_ty::db::HirDatabase>::trait_impls_in_crate
22: hir::Impl::all_for_type
23: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
24: <core::iter::adapters::flatten::Flatten<I> as core::iter::traits::iterator::Iterator>::next
25: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
26: ide::goto_implementation::goto_implementation
27: std::panicking::try
28: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
29: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
30: rust_analyzer::handlers::handle_hover
31: std::panicking::try
32: <F as threadpool::FnBox>::call_box
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 17:59:38] Request textDocument/hover failed.
Message: server panicked: index out of bounds: the len is 1 but the index is 1
Code: -32603
Panic context:
>
version: 5506e0dfa 2021-09-04 nightly
request: textDocument/hover HoverParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "/home/jplatte/code/ruma/crates/ruma-state-res/src/event_auth.rs",
query: None,
fragment: None,
},
},
position: Position(
Position {
line: 23,
character: 19,
},
),
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
}
> DefMap CrateId(1069) None path Registry
thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 1', crates/hir_def/src/nameres/path_resolution.rs:394:33
stack backtrace:
0: rust_begin_unwind
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/panicking.rs:515:5
1: core::panicking::panic_fmt
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:92:14
2: core::panicking::panic_bounds_check
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:69:5
3: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro_single
4: hir_def::resolver::Resolver::resolve_path_in_type_ns
5: hir_ty::lower::TyLoweringContext::lower_ty_ext
6: hir_ty::lower::impl_self_ty_query
7: salsa::runtime::Runtime::execute_query_implementation
8: salsa::derived::slot::Slot<Q,MP>::read_upgrade
9: salsa::derived::slot::Slot<Q,MP>::read
10: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
11: <DB as hir_ty::db::HirDatabase>::impl_self_ty
12: hir_ty::lower::impl_trait_query
13: salsa::runtime::Runtime::execute_query_implementation
14: salsa::derived::slot::Slot<Q,MP>::read_upgrade
15: salsa::derived::slot::Slot<Q,MP>::maybe_changed_since
16: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::maybe_changed_since
17: salsa::derived::slot::MemoRevisions::validate_memoized_value
18: salsa::derived::slot::Slot<Q,MP>::read_upgrade
19: salsa::derived::slot::Slot<Q,MP>::read
20: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
21: <DB as hir_ty::db::HirDatabase>::trait_impls_in_crate
22: hir::Impl::all_for_type
23: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
24: <core::iter::adapters::flatten::Flatten<I> as core::iter::traits::iterator::Iterator>::next
25: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
26: ide::goto_implementation::goto_implementation
27: std::panicking::try
28: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
29: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
30: rust_analyzer::handlers::handle_hover
31: std::panicking::try
32: <F as threadpool::FnBox>::call_box
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 18:00:20] Request textDocument/hover failed.
Message: server panicked: index out of bounds: the len is 1 but the index is 1
Code: -32603
Panic context:
>
version: 5506e0dfa 2021-09-04 nightly
request: textDocument/hover HoverParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "/home/jplatte/code/ruma/crates/ruma-state-res/src/lib.rs",
query: None,
fragment: None,
},
},
position: Position(
Position {
line: 446,
character: 33,
},
),
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
}
> DefMap CrateId(781) None path serde_if_integer128
thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 5', crates/hir_def/src/nameres/path_resolution.rs:394:33
stack backtrace:
0: rust_begin_unwind
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/panicking.rs:515:5
1: core::panicking::panic_fmt
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:92:14
2: core::panicking::panic_bounds_check
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:69:5
3: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro_single
4: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro
5: hir_def::macro_call_as_call_id
6: <hir_expand::InFile<&syntax::ast::generated::nodes::MacroCall> as hir_def::AsMacroCall>::as_call_id_with_errors
7: hir_def::body::Expander::enter_expand
8: hir_def::data::collect_items
9: hir_def::data::TraitData::trait_data_query
10: salsa::runtime::Runtime::execute_query_implementation
11: salsa::derived::slot::Slot<Q,MP>::read_upgrade
12: salsa::derived::slot::Slot<Q,MP>::maybe_changed_since
13: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::maybe_changed_since
14: salsa::derived::slot::MemoRevisions::validate_memoized_value
15: salsa::derived::slot::Slot<Q,MP>::read_upgrade
16: salsa::derived::slot::Slot<Q,MP>::read
17: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
18: <DB as hir_ty::db::HirDatabase>::impl_datum
19: chalk_solve::clauses::program_clauses_that_could_match
20: chalk_recursive::solve::SolveIteration::solve_iteration
21: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
22: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
23: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
24: chalk_recursive::solve::SolveIteration::solve_iteration
25: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
26: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_root_goal
27: <hir_ty::db::TraitSolveQueryQuery as salsa::plumbing::QueryFunction>::execute
28: salsa::runtime::Runtime::execute_query_implementation
29: salsa::derived::slot::Slot<Q,MP>::read_upgrade
30: salsa::derived::slot::Slot<Q,MP>::read
31: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
32: <DB as hir_ty::db::HirDatabase>::trait_solve_query::__shim
33: <DB as hir_ty::db::HirDatabase>::trait_solve_query
34: hir_ty::db::trait_solve_wait
35: <DB as hir_ty::db::HirDatabase>::trait_solve
36: hir_ty::infer::unify::InferenceTable::register_obligation_in_env
37: hir_ty::infer::unify::InferenceTable::normalize_projection_ty
38: <hir_ty::fold_tys::TyFolder<F> as chalk_ir::fold::Folder<hir_ty::interner::Interner>>::fold_ty
39: chalk_ir::fold::boring_impls::<impl chalk_ir::fold::Fold<I> for chalk_ir::GenericArg<I>>::fold_with
40: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend
41: chalk_ir::fold::boring_impls::<impl chalk_ir::fold::Fold<I> for chalk_ir::Substitution<I>>::fold_with
42: <chalk_ir::Ty<I> as chalk_ir::fold::SuperFold<I>>::super_fold_with
43: <hir_ty::fold_tys::TyFolder<F> as chalk_ir::fold::Folder<hir_ty::interner::Interner>>::fold_ty
44: hir_ty::infer::InferenceContext::make_ty_with_mode
45: hir_ty::infer::infer_query
46: salsa::runtime::Runtime::execute_query_implementation
47: salsa::derived::slot::Slot<Q,MP>::read_upgrade
48: salsa::derived::slot::Slot<Q,MP>::read
49: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
50: <DB as hir_ty::db::HirDatabase>::infer_query
51: hir_ty::db::infer_wait
52: hir::source_analyzer::SourceAnalyzer::new_for_body
53: hir::semantics::SemanticsImpl::analyze_impl
54: ide_db::defs::NameRefClass::classify
55: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
56: <itertools::unique_impl::Unique<I> as core::iter::traits::iterator::Iterator>::next
57: <core::iter::adapters::flatten::Flatten<I> as core::iter::traits::iterator::Iterator>::next
58: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
59: ide::goto_implementation::goto_implementation
60: std::panicking::try
61: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
62: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
63: rust_analyzer::handlers::handle_hover
64: std::panicking::try
65: <F as threadpool::FnBox>::call_box
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 18:02:53] Request textDocument/hover failed.
Message: server panicked: index out of bounds: the len is 1 but the index is 5
Code: -32603
Panic context:
>
version: 5506e0dfa 2021-09-04 nightly
request: textDocument/hover HoverParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "/home/jplatte/code/ruma/crates/ruma-state-res/src/lib.rs",
query: None,
fragment: None,
},
},
position: Position(
Position {
line: 620,
character: 56,
},
),
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
}
> DefMap CrateId(781) None path serde_if_integer128
thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 5', crates/hir_def/src/nameres/path_resolution.rs:394:33
stack backtrace:
0: rust_begin_unwind
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/panicking.rs:515:5
1: core::panicking::panic_fmt
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:92:14
2: core::panicking::panic_bounds_check
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:69:5
3: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro_single
4: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro
5: hir_def::macro_call_as_call_id
6: <hir_expand::InFile<&syntax::ast::generated::nodes::MacroCall> as hir_def::AsMacroCall>::as_call_id_with_errors
7: hir_def::body::Expander::enter_expand
8: hir_def::data::collect_items
9: hir_def::data::TraitData::trait_data_query
10: salsa::runtime::Runtime::execute_query_implementation
11: salsa::derived::slot::Slot<Q,MP>::read_upgrade
12: salsa::derived::slot::Slot<Q,MP>::maybe_changed_since
13: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::maybe_changed_since
14: salsa::derived::slot::MemoRevisions::validate_memoized_value
15: salsa::derived::slot::Slot<Q,MP>::read_upgrade
16: salsa::derived::slot::Slot<Q,MP>::read
17: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
18: <DB as hir_ty::db::HirDatabase>::impl_datum
19: chalk_solve::clauses::program_clauses_that_could_match
20: chalk_recursive::solve::SolveIteration::solve_iteration
21: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
22: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
23: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
24: chalk_recursive::solve::SolveIteration::solve_iteration
25: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
26: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_root_goal
27: <hir_ty::db::TraitSolveQueryQuery as salsa::plumbing::QueryFunction>::execute
28: salsa::runtime::Runtime::execute_query_implementation
29: salsa::derived::slot::Slot<Q,MP>::read_upgrade
30: salsa::derived::slot::Slot<Q,MP>::read
31: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
32: <DB as hir_ty::db::HirDatabase>::trait_solve_query::__shim
33: <DB as hir_ty::db::HirDatabase>::trait_solve_query
34: hir_ty::db::trait_solve_wait
35: <DB as hir_ty::db::HirDatabase>::trait_solve
36: hir_ty::infer::unify::InferenceTable::register_obligation_in_env
37: hir_ty::infer::unify::InferenceTable::normalize_projection_ty
38: <hir_ty::fold_tys::TyFolder<F> as chalk_ir::fold::Folder<hir_ty::interner::Interner>>::fold_ty
39: chalk_ir::fold::boring_impls::<impl chalk_ir::fold::Fold<I> for chalk_ir::GenericArg<I>>::fold_with
40: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend
41: chalk_ir::fold::boring_impls::<impl chalk_ir::fold::Fold<I> for chalk_ir::Substitution<I>>::fold_with
42: <chalk_ir::Ty<I> as chalk_ir::fold::SuperFold<I>>::super_fold_with
43: <hir_ty::fold_tys::TyFolder<F> as chalk_ir::fold::Folder<hir_ty::interner::Interner>>::fold_ty
44: hir_ty::infer::InferenceContext::make_ty_with_mode
45: hir_ty::infer::infer_query
46: salsa::runtime::Runtime::execute_query_implementation
47: salsa::derived::slot::Slot<Q,MP>::read_upgrade
48: salsa::derived::slot::Slot<Q,MP>::read
49: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
50: <DB as hir_ty::db::HirDatabase>::infer_query
51: hir_ty::db::infer_wait
52: hir::source_analyzer::SourceAnalyzer::new_for_body
53: hir::semantics::SemanticsImpl::analyze_impl
54: ide_db::defs::NameRefClass::classify
55: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
56: <itertools::unique_impl::Unique<I> as core::iter::traits::iterator::Iterator>::next
57: <core::iter::adapters::flatten::Flatten<I> as core::iter::traits::iterator::Iterator>::next
58: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
59: ide::goto_implementation::goto_implementation
60: std::panicking::try
61: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
62: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
63: rust_analyzer::handlers::handle_hover
64: std::panicking::try
65: <F as threadpool::FnBox>::call_box
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Panic context:
>
version: 5506e0dfa 2021-09-04 nightly
request: textDocument/hover HoverParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "/home/jplatte/code/ruma/crates/ruma-state-res/src/test_utils.rs",
query: None,
fragment: None,
},
},
position: Position(
Position {
line: 598,
character: 37,
},
),
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
}
> DefMap CrateId(1069) None path Registry
thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 1', crates/hir_def/src/nameres/path_resolution.rs:394:33
stack backtrace:
0: rust_begin_unwind
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/panicking.rs:515:5
1: core::panicking::panic_fmt
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:92:14
2: core::panicking::panic_bounds_check
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:69:5
3: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro_single
4: hir_def::resolver::Resolver::resolve_path_in_type_ns
5: hir_ty::lower::TyLoweringContext::lower_ty_ext
6: hir_ty::lower::impl_self_ty_query
7: salsa::runtime::Runtime::execute_query_implementation
8: salsa::derived::slot::Slot<Q,MP>::read_upgrade
9: salsa::derived::slot::Slot<Q,MP>::read
10: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
11: <DB as hir_ty::db::HirDatabase>::impl_self_ty
12: hir_ty::lower::impl_trait_query
13: salsa::runtime::Runtime::execute_query_implementation
14: salsa::derived::slot::Slot<Q,MP>::read_upgrade
15: salsa::derived::slot::Slot<Q,MP>::maybe_changed_since
16: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::maybe_changed_since
17: salsa::derived::slot::MemoRevisions::validate_memoized_value
18: salsa::derived::slot::Slot<Q,MP>::read_upgrade
19: salsa::derived::slot::Slot<Q,MP>::read
20: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
21: <DB as hir_ty::db::HirDatabase>::trait_impls_in_crate
22: hir::Impl::all_for_type
23: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
24: <core::iter::adapters::flatten::Flatten<I> as core::iter::traits::iterator::Iterator>::next
25: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
26: ide::goto_implementation::goto_implementation
27: std::panicking::try
28: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
29: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
30: rust_analyzer::handlers::handle_hover
31: std::panicking::try
32: <F as threadpool::FnBox>::call_box
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 18:03:29] Request textDocument/hover failed.
Message: server panicked: index out of bounds: the len is 1 but the index is 1
Code: -32603
Panic context:
>
version: 5506e0dfa 2021-09-04 nightly
request: textDocument/hover HoverParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "/home/jplatte/code/ruma/crates/ruma-state-res/src/test_utils.rs",
query: None,
fragment: None,
},
},
position: Position(
Position {
line: 731,
character: 36,
},
),
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
}
> DefMap CrateId(1069) None path Registry
thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 1', crates/hir_def/src/nameres/path_resolution.rs:394:33
stack backtrace:
0: rust_begin_unwind
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/panicking.rs:515:5
1: core::panicking::panic_fmt
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:92:14
2: core::panicking::panic_bounds_check
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:69:5
3: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro_single
4: hir_def::resolver::Resolver::resolve_path_in_type_ns
5: hir_ty::lower::TyLoweringContext::lower_ty_ext
6: hir_ty::lower::impl_self_ty_query
7: salsa::runtime::Runtime::execute_query_implementation
8: salsa::derived::slot::Slot<Q,MP>::read_upgrade
9: salsa::derived::slot::Slot<Q,MP>::read
10: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
11: <DB as hir_ty::db::HirDatabase>::impl_self_ty
12: hir_ty::lower::impl_trait_query
13: salsa::runtime::Runtime::execute_query_implementation
14: salsa::derived::slot::Slot<Q,MP>::read_upgrade
15: salsa::derived::slot::Slot<Q,MP>::maybe_changed_since
16: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::maybe_changed_since
17: salsa::derived::slot::MemoRevisions::validate_memoized_value
18: salsa::derived::slot::Slot<Q,MP>::read_upgrade
19: salsa::derived::slot::Slot<Q,MP>::read
20: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
21: <DB as hir_ty::db::HirDatabase>::trait_impls_in_crate
22: hir::Impl::all_for_type
23: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
24: <core::iter::adapters::flatten::Flatten<I> as core::iter::traits::iterator::Iterator>::next
25: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
26: ide::goto_implementation::goto_implementation
27: std::panicking::try
28: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
29: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
30: rust_analyzer::handlers::handle_hover
31: std::panicking::try
32: <F as threadpool::FnBox>::call_box
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Panic context:
>
version: 5506e0dfa 2021-09-04 nightly
request: textDocument/hover HoverParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "/home/jplatte/code/ruma/crates/ruma-state-res/benches/state_res_bench.rs",
query: None,
fragment: None,
},
},
position: Position(
Position {
line: 690,
character: 46,
},
),
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
}
> DefMap CrateId(1069) None path Registry
thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 1', crates/hir_def/src/nameres/path_resolution.rs:394:33
stack backtrace:
0: rust_begin_unwind
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/panicking.rs:515:5
1: core::panicking::panic_fmt
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:92:14
2: core::panicking::panic_bounds_check
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:69:5
3: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro_single
4: hir_def::resolver::Resolver::resolve_path_in_type_ns
5: hir_ty::lower::TyLoweringContext::lower_ty_ext
6: hir_ty::lower::impl_self_ty_query
7: salsa::runtime::Runtime::execute_query_implementation
8: salsa::derived::slot::Slot<Q,MP>::read_upgrade
9: salsa::derived::slot::Slot<Q,MP>::read
10: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
11: <DB as hir_ty::db::HirDatabase>::impl_self_ty
12: hir_ty::lower::impl_trait_query
13: salsa::runtime::Runtime::execute_query_implementation
14: salsa::derived::slot::Slot<Q,MP>::read_upgrade
15: salsa::derived::slot::Slot<Q,MP>::maybe_changed_since
16: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::maybe_changed_since
17: salsa::derived::slot::MemoRevisions::validate_memoized_value
18: salsa::derived::slot::Slot<Q,MP>::read_upgrade
19: salsa::derived::slot::Slot<Q,MP>::read
20: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
21: <DB as hir_ty::db::HirDatabase>::trait_impls_in_crate
22: hir::Impl::all_for_type
23: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
24: <core::iter::adapters::flatten::Flatten<I> as core::iter::traits::iterator::Iterator>::next
25: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
26: ide::goto_implementation::goto_implementation
27: std::panicking::try
28: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
29: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
30: rust_analyzer::handlers::handle_hover
31: std::panicking::try
32: <F as threadpool::FnBox>::call_box
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 18:08:01] Request textDocument/hover failed.
Message: server panicked: index out of bounds: the len is 1 but the index is 1
Code: -32603
Panic context:
>
version: 5506e0dfa 2021-09-04 nightly
request: textDocument/hover HoverParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "/home/jplatte/code/ruma/crates/ruma-state-res/src/state_event.rs",
query: None,
fragment: None,
},
},
position: Position(
Position {
line: 33,
character: 45,
},
),
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
}
> DefMap CrateId(1069) None path Registry
thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 1', crates/hir_def/src/nameres/path_resolution.rs:394:33
stack backtrace:
0: rust_begin_unwind
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/panicking.rs:515:5
1: core::panicking::panic_fmt
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:92:14
2: core::panicking::panic_bounds_check
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:69:5
3: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro_single
4: hir_def::resolver::Resolver::resolve_path_in_type_ns
5: hir_ty::lower::TyLoweringContext::lower_ty_ext
6: hir_ty::lower::impl_self_ty_query
7: salsa::runtime::Runtime::execute_query_implementation
8: salsa::derived::slot::Slot<Q,MP>::read_upgrade
9: salsa::derived::slot::Slot<Q,MP>::read
10: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
11: <DB as hir_ty::db::HirDatabase>::impl_self_ty
12: hir_ty::lower::impl_trait_query
13: salsa::runtime::Runtime::execute_query_implementation
14: salsa::derived::slot::Slot<Q,MP>::read_upgrade
15: salsa::derived::slot::Slot<Q,MP>::maybe_changed_since
16: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::maybe_changed_since
17: salsa::derived::slot::MemoRevisions::validate_memoized_value
18: salsa::derived::slot::Slot<Q,MP>::read_upgrade
19: salsa::derived::slot::Slot<Q,MP>::read
20: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
21: <DB as hir_ty::db::HirDatabase>::trait_impls_in_crate
22: hir::Impl::all_for_trait
23: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
24: <core::iter::adapters::flatten::Flatten<I> as core::iter::traits::iterator::Iterator>::next
25: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
26: ide::goto_implementation::goto_implementation
27: std::panicking::try
28: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
29: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
30: rust_analyzer::handlers::handle_hover
31: std::panicking::try
32: <F as threadpool::FnBox>::call_box
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 18:13:43] Request textDocument/hover failed.
Message: server panicked: index out of bounds: the len is 1 but the index is 1
Code: -32603
I've added some more logging in #10159, so please post another panic message when you encounter this again
Panic context:
>
version: 3dae94bf2 2021-09-08 nightly
request: textDocument/hover HoverParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "/home/jplatte/code/matrix-rust-sdk/matrix_sdk/tests/event_handler.rs",
query: None,
fragment: None,
},
},
position: Position(
Position {
line: 3,
character: 37,
},
),
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
}
> impl_trait_query(ImplId(22411) -> ImplData { target_trait: Some(TraitRef { path: Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Drop"))] }, generic_args: [None] } }), self_ty: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("MemBioSlice"))] }, generic_args: [Some(GenericArgs { args: [Lifetime(LifetimeRef { name: Name(Text("'a")) })], has_self_type: false, bindings: [] })] }), items: [FunctionId(FunctionId(33621))], is_negative: false })
> DefMap CrateId(756) crate_name=Some(CrateDisplayName { crate_name: CrateName("mod"), canonical_name: "mod" }) block=None path=MemBioSlice
thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 2', crates/hir_def/src/nameres/path_resolution.rs:395:33
stack backtrace:
0: rust_begin_unwind
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/panicking.rs:515:5
1: core::panicking::panic_fmt
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:92:14
2: core::panicking::panic_bounds_check
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:69:5
3: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro_single
4: hir_def::resolver::Resolver::resolve_path_in_type_ns
5: hir_ty::lower::TyLoweringContext::lower_ty_ext
6: hir_ty::lower::impl_self_ty_query
7: salsa::runtime::Runtime::execute_query_implementation
8: salsa::derived::slot::Slot<Q,MP>::read_upgrade
9: salsa::derived::slot::Slot<Q,MP>::read
10: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
11: <DB as hir_ty::db::HirDatabase>::impl_self_ty
12: hir_ty::lower::impl_trait_query
13: salsa::runtime::Runtime::execute_query_implementation
14: salsa::derived::slot::Slot<Q,MP>::read_upgrade
15: salsa::derived::slot::Slot<Q,MP>::maybe_changed_since
16: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::maybe_changed_since
17: salsa::derived::slot::MemoRevisions::validate_memoized_value
18: salsa::derived::slot::Slot<Q,MP>::read_upgrade
19: salsa::derived::slot::Slot<Q,MP>::read
20: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
21: <DB as hir_ty::db::HirDatabase>::trait_impls_in_crate
22: hir::Impl::all_for_type
23: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
24: <core::iter::adapters::flatten::Flatten<I> as core::iter::traits::iterator::Iterator>::next
25: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
26: ide::goto_implementation::goto_implementation
27: std::panicking::try
28: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
29: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
30: rust_analyzer::handlers::handle_hover
31: std::panicking::try
32: <F as threadpool::FnBox>::call_box
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 23:03:05] Request textDocument/hover failed.
Message: server panicked: index out of bounds: the len is 1 but the index is 2
Code: -32603
Panic context:
>
version: 3dae94bf2 2021-09-08 nightly
request: textDocument/hover HoverParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "/home/jplatte/code/matrix-rust-sdk/matrix_sdk/src/client.rs",
query: None,
fragment: None,
},
},
position: Position(
Position {
line: 3251,
character: 36,
},
),
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
}
> impl_trait_query(ImplId(77846) -> ImplData { target_trait: None, self_ty: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Deserializer"))] }, generic_args: [Some(GenericArgs { args: [Lifetime(LifetimeRef { name: Name(Text("'a")) })], has_self_type: false, bindings: [] })] }), items: [FunctionId(FunctionId(154600)), FunctionId(FunctionId(154601)), FunctionId(FunctionId(154602)), FunctionId(FunctionId(154603))], is_negative: false })
> DefMap CrateId(1131) crate_name=Some(CrateDisplayName { crate_name: CrateName("test_de"), canonical_name: "test_de" }) block=None path=Deserializer
thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 2', crates/hir_def/src/nameres/path_resolution.rs:395:33
stack backtrace:
0: rust_begin_unwind
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/panicking.rs:515:5
1: core::panicking::panic_fmt
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:92:14
2: core::panicking::panic_bounds_check
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:69:5
3: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro_single
4: hir_def::resolver::Resolver::resolve_path_in_type_ns
5: hir_ty::lower::TyLoweringContext::lower_ty_ext
6: hir_ty::lower::impl_self_ty_query
7: salsa::runtime::Runtime::execute_query_implementation
8: salsa::derived::slot::Slot<Q,MP>::read_upgrade
9: salsa::derived::slot::Slot<Q,MP>::read
10: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
11: <DB as hir_ty::db::HirDatabase>::impl_self_ty
12: hir_ty::lower::impl_trait_query
13: salsa::runtime::Runtime::execute_query_implementation
14: salsa::derived::slot::Slot<Q,MP>::read_upgrade
15: salsa::derived::slot::Slot<Q,MP>::maybe_changed_since
16: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::maybe_changed_since
17: salsa::derived::slot::MemoRevisions::validate_memoized_value
18: salsa::derived::slot::Slot<Q,MP>::read_upgrade
19: salsa::derived::slot::Slot<Q,MP>::read
20: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
21: <DB as hir_ty::db::HirDatabase>::trait_impls_in_crate
22: hir::Impl::all_for_type
23: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
24: <core::iter::adapters::flatten::Flatten<I> as core::iter::traits::iterator::Iterator>::next
25: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
26: ide::goto_implementation::goto_implementation
27: std::panicking::try
28: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
29: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
30: rust_analyzer::handlers::handle_hover
31: std::panicking::try
32: <F as threadpool::FnBox>::call_box
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 23:15:39] Request textDocument/hover failed.
Message: server panicked: index out of bounds: the len is 1 but the index is 2
Code: -32603
Looking at the last one in more detail:
> impl_trait_query(ImplId(77846) -> ImplData { target_trait: None, self_ty: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Deserializer"))] }, generic_args: [Some(GenericArgs { args: [Lifetime(LifetimeRef { name: Name(Text("'a")) })], has_self_type: false, bindings: [] })] }), items: [FunctionId(FunctionId(154600)), FunctionId(FunctionId(154601)), FunctionId(FunctionId(154602)), FunctionId(FunctionId(154603))], is_negative: false })
> DefMap CrateId(1131) crate_name=Some(CrateDisplayName { crate_name: CrateName("test_de"), canonical_name: "test_de" }) block=None path=Deserializer
We're trying to get the trait implemented by this serde-yaml impl (which is None, of course). We query the impl's self type, Deserializer<'a>, and resolve that.
Now for some reason, it is using the DefMap of the test_de test in serde-yaml (which only has 1 module) to resolve Deserializer, but from a module that isn't part of this DefMap.
This still makes no sense at all to me, so I added some more info to the context in https://github.com/rust-analyzer/rust-analyzer/pull/10185. @jplatte do you by any chance remember what triggered these panics? I'm still not having any luck reproducing this locally.
I was working on https://github.com/matrix-org/matrix-rust-sdk/pull/309. Maybe you can fudge around with the code introduced by the second-to-last commit there? I think when writing that I got this (but also earlier when working on the same PR).
Either way I'm probably going to work on a followup PR to that in the next days so chances seem high that I'll trigger the bug again 😄
Got the panic again, dump:
Panic context:
>
version: b73b32147 2021-09-06 dev
request: textDocument/hover HoverParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "/home/jplatte/code/ruma/crates/ruma-state-res/src/lib.rs",
query: None,
fragment: None,
},
},
position: Position(
Position {
line: 648,
character: 28,
},
),
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
}
> trait_data_query(TraitId(333) -> ItemLoc { container: ModuleId { krate: CrateId(791), block: None, local_id: Idx::<ModuleData>(5) }, id: ItemTreeId { tree: TreeId { file: HirFileId(FileId(FileId(3696))), block: None }, value: Idx::<Trait>(4) } } -> Trait { name: Name(Text("Deserializer")), visibility: RawVisibilityId("pub"), generic_params: GenericParams { types: Arena { len: 1, data: [TypeParamData { name: Some(Name(Text("Self"))), default: None, provenance: TraitSelf }] }, lifetimes: Arena { len: 1, data: [LifetimeParamData { name: Name(Text("'de")) }] }, consts: Arena { len: 0, data: [] }, where_predicates: [TypeBound { target: TypeRef(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Self"))] }, generic_args: [None] })), bound: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Sized"))] }, generic_args: [None] }, None) }] }, is_auto: false, is_unsafe: false, items: [TypeAlias(Idx::<TypeAlias>(2)), Function(Idx::<Function>(9)), Function(Idx::<Function>(10)), Function(Idx::<Function>(11)), Function(Idx::<Function>(12)), Function(Idx::<Function>(13)), Function(Idx::<Function>(14)), MacroCall(Idx::<MacroCall>(19)), Function(Idx::<Function>(15)), Function(Idx::<Function>(16)), Function(Idx::<Function>(17)), Function(Idx::<Function>(18)), MacroCall(Idx::<MacroCall>(20)), Function(Idx::<Function>(19)), Function(Idx::<Function>(20)), Function(Idx::<Function>(21)), Function(Idx::<Function>(22)), Function(Idx::<Function>(23)), Function(Idx::<Function>(24)), Function(Idx::<Function>(25)), Function(Idx::<Function>(26)), Function(Idx::<Function>(27)), Function(Idx::<Function>(28)), Function(Idx::<Function>(29)), Function(Idx::<Function>(30)), Function(Idx::<Function>(31)), Function(Idx::<Function>(32)), Function(Idx::<Function>(33)), Function(Idx::<Function>(34)), Function(Idx::<Function>(35)), Function(Idx::<Function>(36)), Function(Idx::<Function>(37)), Function(Idx::<Function>(38))], ast_id: FileAstId::<syntax::ast::generated::nodes::Trait>(22) })
> collect_items MacroCall: serde_if_integer128! {
/// Hint that the `Deserialize` type is expecting an `i128` value.
///
/// This method is available only on Rust compiler versions >=1.26. The
/// default behavior unconditionally returns an error.
fn deserialize_i128<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where
V: Visitor<'de>
{
let _ = visitor;
Err(Error::custom("i128 is not supported"))
}
}
> DefMap CrateId(791) crate_name=Some(CrateDisplayName { crate_name: CrateName("build_script_build"), canonical_name: "build-script-build" }) block=None path=serde_if_integer128
thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 5', crates/hir_def/src/nameres/path_resolution.rs:395:33
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Panic context:
>
version: b73b32147 2021-09-06 dev
request: textDocument/hover HoverParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "/home/jplatte/code/ruma/crates/ruma-state-res/src/lib.rs",
query: None,
fragment: None,
},
},
position: Position(
Position {
line: 258,
character: 19,
},
),
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
}
> impl_trait_query(ImplId(20813) -> ImplData { target_trait: Some(TraitRef { path: Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Codec"))] }, generic_args: [None] } }), self_ty: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("AlertMessagePayload"))] }, generic_args: [None] }), items: [FunctionId(FunctionId(75933)), FunctionId(FunctionId(75934))], is_negative: false })
> DefMap CrateId(753) crate_name=Some(CrateDisplayName { crate_name: CrateName("bench"), canonical_name: "bench" }) block=None path=AlertMessagePayload
thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 3', crates/hir_def/src/nameres/path_resolution.rs:395:33
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Panic context:
>
version: b73b32147 2021-09-06 dev
request: textDocument/hover HoverParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "/home/jplatte/code/ruma/crates/ruma-state-res/src/lib.rs",
query: None,
fragment: None,
},
},
position: Position(
Position {
line: 57,
character: 23,
},
),
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
}
> impl_trait_query(ImplId(20813) -> ImplData { target_trait: Some(TraitRef { path: Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Codec"))] }, generic_args: [None] } }), self_ty: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("AlertMessagePayload"))] }, generic_args: [None] }), items: [FunctionId(FunctionId(75933)), FunctionId(FunctionId(75934))], is_negative: false })
> DefMap CrateId(753) crate_name=Some(CrateDisplayName { crate_name: CrateName("bench"), canonical_name: "bench" }) block=None path=AlertMessagePayload
thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 3', crates/hir_def/src/nameres/path_resolution.rs:395:33
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 00:49:21] Request textDocument/hover failed.
Message: server panicked: index out of bounds: the len is 1 but the index is 3
Code: -32603
Panic context:
>
version: b73b32147 2021-09-06 dev
request: textDocument/hover HoverParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "/home/jplatte/code/ruma/crates/ruma-state-res/src/lib.rs",
query: None,
fragment: None,
},
},
position: Position(
Position {
line: 62,
character: 28,
},
),
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
}
> impl_trait_query(ImplId(20813) -> ImplData { target_trait: Some(TraitRef { path: Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Codec"))] }, generic_args: [None] } }), self_ty: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("AlertMessagePayload"))] }, generic_args: [None] }), items: [FunctionId(FunctionId(75933)), FunctionId(FunctionId(75934))], is_negative: false })
> DefMap CrateId(753) crate_name=Some(CrateDisplayName { crate_name: CrateName("bench"), canonical_name: "bench" }) block=None path=AlertMessagePayload
thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 3', crates/hir_def/src/nameres/path_resolution.rs:395:33
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 00:50:59] Request textDocument/hover failed.
Message: server panicked: index out of bounds: the len is 1 but the index is 3
Code: -32603
Panic context:
>
version: b73b32147 2021-09-06 dev
request: textDocument/hover HoverParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "/home/jplatte/code/ruma/crates/ruma-state-res/src/lib.rs",
query: None,
fragment: None,
},
},
position: Position(
Position {
line: 56,
character: 32,
},
),
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
}
> impl_trait_query(ImplId(20813) -> ImplData { target_trait: Some(TraitRef { path: Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Codec"))] }, generic_args: [None] } }), self_ty: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("AlertMessagePayload"))] }, generic_args: [None] }), items: [FunctionId(FunctionId(75933)), FunctionId(FunctionId(75934))], is_negative: false })
> DefMap CrateId(753) crate_name=Some(CrateDisplayName { crate_name: CrateName("bench"), canonical_name: "bench" }) block=None path=AlertMessagePayload
thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 3', crates/hir_def/src/nameres/path_resolution.rs:395:33
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Panic context:
>
version: b73b32147 2021-09-06 dev
request: textDocument/hover HoverParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "/home/jplatte/code/ruma/crates/ruma-state-res/src/lib.rs",
query: None,
fragment: None,
},
},
position: Position(
Position {
line: 61,
character: 25,
},
),
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
}
> impl_trait_query(ImplId(20813) -> ImplData { target_trait: Some(TraitRef { path: Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Codec"))] }, generic_args: [None] } }), self_ty: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("AlertMessagePayload"))] }, generic_args: [None] }), items: [FunctionId(FunctionId(75933)), FunctionId(FunctionId(75934))], is_negative: false })
> DefMap CrateId(753) crate_name=Some(CrateDisplayName { crate_name: CrateName("bench"), canonical_name: "bench" }) block=None path=AlertMessagePayload
thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 3', crates/hir_def/src/nameres/path_resolution.rs:395:33
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 01:27:22] Request textDocument/hover failed.
Message: server panicked: index out of bounds: the len is 1 but the index is 3
Code: -32603
Repo at or right after the crash: https://github.com/ruma/ruma/tree/ra-panic-2021-09-12
Panicking whenever hovering the Option here in my current session https://github.com/rust-analyzer/rust-analyzer/blob/516eb40ba5b9d20e59e98185d1b2fcba5599ef7a/crates/base_db/src/fixture.rs#L91
Interestingly enough, the output of the debug prints you added differs on each panic... and if triggered often enough it stops panicking.
>
version: 3e056b9e90 dev
request: textDocument/hover HoverParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "/c%3A/Workspace/Rust/rust-analyzer/crates/base_db/src/fixture.rs",
query: None,
fragment: None,
},
},
position: Position(
Position {
line: 90,
character: 42,
},
),
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
}
> impl_trait_query(ImplId(20425) -> ItemLoc { container: ModuleId { krate: CrateId(330), block: None, local_id: Idx::<ModuleData>(1) }, id: ItemTreeId { tree: TreeId { file: HirFileId(FileId(FileId(1788))), block: None }, value: Idx::<Impl>(0) } } -> ImplData { target_trait: None, self_ty: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("HtmlWriter"))] }, generic_args: [Some(GenericArgs { args: [Lifetime(LifetimeRef { name: Name(Text("'a")) }), Type(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("I"))] }, generic_args: [None] })), Type(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("W"))] }, generic_args: [None] }))], has_self_type: false, bindings: [] })] }), items: [FunctionId(FunctionId(58914)), FunctionId(FunctionId(58915)), FunctionId(FunctionId(58916)), FunctionId(FunctionId(58917)), FunctionId(FunctionId(58918)), FunctionId(FunctionId(58919)), FunctionId(FunctionId(58920))], is_negative: false })
> impl_self_ty_query(ImplId(20425) -> ItemLoc { container: ModuleId { krate: CrateId(330), block: None, local_id: Idx::<ModuleData>(1) }, id: ItemTreeId { tree: TreeId { file: HirFileId(FileId(FileId(1788))), block: None }, value: Idx::<Impl>(0) } } -> ImplData { target_trait: None, self_ty: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("HtmlWriter"))] }, generic_args: [Some(GenericArgs { args: [Lifetime(LifetimeRef { name: Name(Text("'a")) }), Type(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("I"))] }, generic_args: [None] })), Type(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("W"))] }, generic_args: [None] }))], has_self_type: false, bindings: [] })] }), items: [FunctionId(FunctionId(58914)), FunctionId(FunctionId(58915)), FunctionId(FunctionId(58916)), FunctionId(FunctionId(58917)), FunctionId(FunctionId(58918)), FunctionId(FunctionId(58919)), FunctionId(FunctionId(58920))], is_negative: false })
> DefMap CrateId(330) crate_name=Some(CrateDisplayName { crate_name: CrateName("pulldown_cmark"), canonical_name: "pulldown-cmark" }) block=None path=HtmlWriter
thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 1', crates\hir_def\src\nameres\path_resolution.rs:395:33
stack backtrace:
0: std::panicking::begin_panic_handler
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b\/library\std\src\panicking.rs:515
1: core::panicking::panic_fmt
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b\/library\core\src\panicking.rs:92
2: core::panicking::panic_bounds_check
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b\/library\core\src\panicking.rs:69
3: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro_single
4: hir_def::resolver::Resolver::resolve_path_in_type_ns
5: hir_ty::lower::TyLoweringContext::lower_ty_ext
6: hir_ty::lower::impl_self_ty_query
7: salsa::runtime::Runtime::execute_query_implementation
8: core::ptr::drop_in_place<core::option::Option<chalk_ir::Variances<hir_ty::interner::Interner>>>
9: salsa::derived::slot::Slot<Q,MP>::read
10: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
11: <DB as hir_ty::db::HirDatabase>::impl_self_ty::__shim
12: hir_ty::lower::impl_trait_query
13: salsa::runtime::Runtime::execute_query_implementation
14: core::ptr::drop_in_place<core::option::Option<chalk_ir::Variances<hir_ty::interner::Interner>>>
15: salsa::derived::slot::Slot<Q,MP>::maybe_changed_since
16: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::maybe_changed_since
17: hir_ty::db::HirDatabaseGroupStorage__::maybe_changed_since
18: <ide_db::RootDatabase as salsa::plumbing::DatabaseOps>::maybe_changed_since
19: salsa::derived::slot::MemoRevisions::validate_memoized_value
20: core::ptr::drop_in_place<core::option::Option<chalk_ir::Variances<hir_ty::interner::Interner>>>
21: salsa::derived::slot::Slot<Q,MP>::read
22: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
23: <DB as hir_ty::db::HirDatabase>::trait_impls_in_crate::__shim
24: hir::Impl::all_for_type
25: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
26: hashbrown::raw::RawTable<T,A>::shrink_to
27: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
28: ide::goto_implementation::goto_implementation
29: std::panicking::try
30: ide::Analysis::goto_implementation
31: rust_analyzer::handlers::show_impl_command_link
32: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
33: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
34: rust_analyzer::handlers::handle_hover
35: std::panicking::try
36: <F as threadpool::FnBox>::call_box
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 오전 12:57:31] Request textDocument/hover failed.
Message: server panicked: index out of bounds: the len is 1 but the index is 1
Code: -32603
I re-hovered the ident until it stopped panicking at which point it worked normally, here is the entire panic log for this https://gist.github.com/Veykril/9c189877bb965b006bdd0eefa5570ec5
Edit: Just ran into this again, this time hovering std's Arc, at which point hovering any type or trait of std caused the panic.
Same issue for me as for @Veykril. Can provide more info if needed.
Same issue for me.
Log: https://gist.github.com/f32by/4ed1151cdb5a71e39fc0d46970fb540a
Panicking when hovering AsRef and Display in following code snippet.
impl<T> ExpectLogError<T> for Option<T> {
#[inline]
fn expect_log_err<S>(self, msg: S) -> T
where
S: AsRef<str> + fmt::Display,
{
match self {
Some(v) => v,
None => panic_with_log!(msg),
}
}
}
After adding some asserts for myself and having fortunately triggered some of them it seems like the tuple in the vec![(def_map.clone(), self.local_id)]; here
https://github.com/rust-analyzer/rust-analyzer/blob/c577e128fc3aa9d5cf113c24c7f425e2b68bb2b6/crates/hir_def/src/resolver.rs#L739-L753
is incorrect.
Unfortunately forgot to save the stracktrace but the previous call was <hir_def::ImplId as hir_def::resolver::HasResolver>::resolver and then its basically the same stacktrace as the other ones.
So we are somehow creating an invalid module_id in an ImplLoc somewhere which doesn't really make sense... or the def_map query is incorrect.
Yeah, I've looked at the code in hir_def and couldn't find anything that looked wrong (most APIs in there make it very hard to mismatch IDs like that).
It looks to me like something outside of hir_def is causing the problem. Almost as if the data interned in the salsa database gets corrupted or mixed up somehow.
Not sure whether more backtraces are useful, but here is another one and I actually had a closer look. The type being referenced (that's supposed to be resolved?), UnsupportedError, is one that I have no idea where it could come from because that string is not found within the entire codebase I'm working on. Full error:
Panic context:
>
version: f1d7f98ed 2021-09-20 nightly
request: textDocument/hover HoverParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "/home/jplatte/code/matrix-rust-sdk/crates/matrix-sdk/src/event_handler.rs",
query: None,
fragment: None,
},
},
position: Position(
Position {
line: 110,
character: 68,
},
),
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
}
> impl_trait_query(ImplId(22546) -> ItemLoc { container: ModuleId { krate: CrateId(567), block: None, local_id: Idx::<ModuleData>(1) }, id: ItemTreeId { tree: TreeId { file: HirFileId(FileId(FileId(2965))), block: None }, value: Idx::<Impl>(0) } } -> ImplData { target_trait: None, self_ty: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("UnsupportedError"))] }, generic_args: [None] }), items: [FunctionId(FunctionId(31274)), FunctionId(FunctionId(31275)), FunctionId(FunctionId(31276))], is_negative: false })
> impl_self_ty_query(ImplId(22546) -> ItemLoc { container: ModuleId { krate: CrateId(567), block: None, local_id: Idx::<ModuleData>(1) }, id: ItemTreeId { tree: TreeId { file: HirFileId(FileId(FileId(2965))), block: None }, value: Idx::<Impl>(0) } } -> ImplData { target_trait: None, self_ty: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("UnsupportedError"))] }, generic_args: [None] }), items: [FunctionId(FunctionId(31274)), FunctionId(FunctionId(31275)), FunctionId(FunctionId(31276))], is_negative: false })
> DefMap CrateId(567) crate_name=Some(CrateDisplayName { crate_name: CrateName("all"), canonical_name: "all" }) block=None path=UnsupportedError
thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 1', crates/hir_def/src/nameres/path_resolution.rs:395:33
stack backtrace:
0: rust_begin_unwind
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:515:5
1: core::panicking::panic_fmt
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/panicking.rs:92:14
2: core::panicking::panic_bounds_check
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/panicking.rs:69:5
3: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro_single
4: hir_def::resolver::Resolver::resolve_path_in_type_ns
5: hir_ty::lower::TyLoweringContext::lower_ty_ext
6: hir_ty::lower::impl_self_ty_query
7: salsa::runtime::Runtime::execute_query_implementation
8: salsa::derived::slot::Slot<Q,MP>::read_upgrade
9: salsa::derived::slot::Slot<Q,MP>::read
10: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
11: <DB as hir_ty::db::HirDatabase>::impl_self_ty
12: hir_ty::lower::impl_trait_query
13: salsa::runtime::Runtime::execute_query_implementation
14: salsa::derived::slot::Slot<Q,MP>::read_upgrade
15: salsa::derived::slot::Slot<Q,MP>::maybe_changed_since
16: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::maybe_changed_since
17: salsa::derived::slot::MemoRevisions::validate_memoized_value
18: salsa::derived::slot::Slot<Q,MP>::read_upgrade
19: salsa::derived::slot::Slot<Q,MP>::read
20: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
21: <DB as hir_ty::db::HirDatabase>::trait_impls_in_crate
22: hir::Impl::all_for_type
23: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
24: <core::iter::adapters::flatten::Flatten<I> as core::iter::traits::iterator::Iterator>::next
25: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
26: ide::goto_implementation::goto_implementation
27: std::panicking::try
28: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
29: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
30: rust_analyzer::handlers::handle_hover
31: std::panicking::try
32: <F as threadpool::FnBox>::call_box
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 12:30:46] Request textDocument/hover failed.
Message: server panicked: index out of bounds: the len is 1 but the index is 1
Code: -32603
@jplatte that might come from the image crate, but I wonder why it says all.
Hopefully this is helpful but I just ran into this when hovering over PathBuf - trace:
[Error - 12:43:08 PM] Request textDocument/hover failed.
Message: server panicked: index out of bounds: the len is 1 but the index is 1
Code: -32603
Panic context:
>
version: f1d7f98ed 2021-09-20 stable
request: textDocument/hover HoverParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "<redacted>",
query: None,
fragment: None,
},
},
position: Position(
Position {
line: 113,
character: 44,
},
),
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
}
> impl_trait_query(ImplId(145341) -> ItemLoc { container: ModuleId { krate: CrateId(2420), block: None, local_id: Idx::<ModuleData>(1) }, id: ItemTreeId { tree: TreeId { file: HirFileId(FileId(FileId(9356))), block: None }, value: Idx::<Impl>(0) } } -> ImplData { target_trait: Some(TraitRef { path: Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Default"))] }, generic_args: [None] } }), self_ty: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Array64"))] }, generic_args: [Some(GenericArgs { args: [Type(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("T"))] }, generic_args: [None] }))], has_self_type: false, bindings: [] })] }), items: [FunctionId(FunctionId(358060))], is_negative: false })
> impl_self_ty_query(ImplId(145341) -> ItemLoc { container: ModuleId { krate: CrateId(2420), block: None, local_id: Idx::<ModuleData>(1) }, id: ItemTreeId { tree: TreeId { file: HirFileId(FileId(FileId(9356))), block: None }, value: Idx::<Impl>(0) } } -> ImplData { target_trait: Some(TraitRef { path: Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Default"))] }, generic_args: [None] } }), self_ty: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Array64"))] }, generic_args: [Some(GenericArgs { args: [Type(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("T"))] }, generic_args: [None] }))], has_self_type: false, bindings: [] })] }), items: [FunctionId(FunctionId(358060))], is_negative: false })
> DefMap CrateId(2420) crate_name=Some(CrateDisplayName { crate_name: CrateName("misc"), canonical_name: "misc" }) block=None path=Array64
thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 1', crates/hir_def/src/nameres/path_resolution.rs:395:33
stack backtrace:
0: rust_begin_unwind
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:515:5
1: core::panicking::panic_fmt
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/panicking.rs:92:14
2: core::panicking::panic_bounds_check
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/panicking.rs:69:5
3: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro_single
4: hir_def::resolver::Resolver::resolve_path_in_type_ns
5: hir_ty::lower::TyLoweringContext::lower_ty_ext
6: hir_ty::lower::impl_self_ty_query
7: salsa::runtime::Runtime::execute_query_implementation
8: salsa::derived::slot::Slot<Q,MP>::read_upgrade
9: salsa::derived::slot::Slot<Q,MP>::read
10: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
11: <DB as hir_ty::db::HirDatabase>::impl_self_ty
12: hir_ty::lower::impl_trait_query
13: salsa::runtime::Runtime::execute_query_implementation
14: salsa::derived::slot::Slot<Q,MP>::read_upgrade
15: salsa::derived::slot::Slot<Q,MP>::maybe_changed_since
16: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::maybe_changed_since
17: salsa::derived::slot::MemoRevisions::validate_memoized_value
18: salsa::derived::slot::Slot<Q,MP>::read_upgrade
19: salsa::derived::slot::Slot<Q,MP>::read
20: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
21: <DB as hir_ty::db::HirDatabase>::trait_impls_in_crate
22: hir::Impl::all_for_type
23: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
24: <core::iter::adapters::flatten::Flatten<I> as core::iter::traits::iterator::Iterator>::next
25: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
26: ide::goto_implementation::goto_implementation
27: std::panicking::try
28: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
29: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
30: rust_analyzer::handlers::handle_hover
31: std::panicking::try
32: <F as threadpool::FnBox>::call_box
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 12:43:13 PM] Request textDocument/hover failed.
Message: server panicked: index out of bounds: the len is 1 but the index is 1
Code: -32603
I ran into this when hovering String in an Enum declaration. The code is private, so I can't share the full context, but the block I was looking at looked like this (hovering the String part of the Identifier variant):
#[derive(Debug, Eq, PartialEq)]
enum ContextPredicate {
Identifier(String),
Equal(String, String),
NotEqual(String, String),
Not(Box<ContextPredicate>),
And(Box<ContextPredicate>, Box<ContextPredicate>),
Or(Box<ContextPredicate>, Box<ContextPredicate>),
Just(bool),
}
Trace from the Output window:
Panic context:
>
version: 009e6ceb1 2021-09-27 stable
request: textDocument/hover HoverParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "<REDACTED>/src/keymap.rs",
query: None,
fragment: None,
},
},
position: Position(
Position {
line: 62,
character: 17,
},
),
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
}
> impl_trait_query(ImplId(65897) -> ItemLoc { container: ModuleId { krate: CrateId(1319), block: None, local_id: Idx::<ModuleData>(1) }, id: ItemTreeId { tree: TreeId { file: HirFileId(FileId(FileId(5518))), block: None }, value: Idx::<Impl>(0) } } -> ImplData { target_trait: None, self_ty: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("AABB"))] }, generic_args: [Some(GenericArgs { args: [Type(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("P"))] }, generic_args: [None] }))], has_self_type: false, bindings: [] })] }), items: [FunctionId(FunctionId(133127)), FunctionId(FunctionId(133128)), FunctionId(FunctionId(133129)), FunctionId(FunctionId(133130)), FunctionId(FunctionId(133131)), FunctionId(FunctionId(133132)), FunctionId(FunctionId(133133)), FunctionId(FunctionId(133134))], is_negative: false })
> impl_self_ty_query(ImplId(65897) -> ItemLoc { container: ModuleId { krate: CrateId(1319), block: None, local_id: Idx::<ModuleData>(1) }, id: ItemTreeId { tree: TreeId { file: HirFileId(FileId(FileId(5518))), block: None }, value: Idx::<Impl>(0) } } -> ImplData { target_trait: None, self_ty: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("AABB"))] }, generic_args: [Some(GenericArgs { args: [Type(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("P"))] }, generic_args: [None] }))], has_self_type: false, bindings: [] })] }), items: [FunctionId(FunctionId(133127)), FunctionId(FunctionId(133128)), FunctionId(FunctionId(133129)), FunctionId(FunctionId(133130)), FunctionId(FunctionId(133131)), FunctionId(FunctionId(133132)), FunctionId(FunctionId(133133)), FunctionId(FunctionId(133134))], is_negative: false })
> DefMap CrateId(1319) crate_name=Some(CrateDisplayName { crate_name: CrateName("macro_examples"), canonical_name: "macro_examples" }) block=None path=AABB
thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 1', crates/hir_def/src/nameres/path_resolution.rs:395:33
stack backtrace:
0: _rust_begin_unwind
1: core::panicking::panic_fmt
2: core::panicking::panic_bounds_check
3: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro_single
4: hir_def::resolver::Resolver::resolve_path_in_type_ns
5: hir_ty::lower::TyLoweringContext::lower_ty_ext
6: hir_ty::lower::impl_self_ty_query
7: salsa::runtime::Runtime::execute_query_implementation
8: salsa::derived::slot::Slot<Q,MP>::read_upgrade
9: salsa::derived::slot::Slot<Q,MP>::read
10: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
11: <DB as hir_ty::db::HirDatabase>::impl_self_ty
12: hir_ty::lower::impl_trait_query
13: salsa::runtime::Runtime::execute_query_implementation
14: salsa::derived::slot::Slot<Q,MP>::read_upgrade
15: salsa::derived::slot::Slot<Q,MP>::maybe_changed_since
16: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::maybe_changed_since
17: salsa::derived::slot::MemoRevisions::validate_memoized_value
18: salsa::derived::slot::Slot<Q,MP>::read_upgrade
19: salsa::derived::slot::Slot<Q,MP>::read
20: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
21: <DB as hir_ty::db::HirDatabase>::trait_impls_in_crate
22: hir::Impl::all_for_type
23: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
24: <core::iter::adapters::flatten::Flatten<I> as core::iter::traits::iterator::Iterator>::next
25: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
26: ide::goto_implementation::goto_implementation
27: std::panicking::try
28: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
29: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
30: rust_analyzer::handlers::handle_hover
31: std::panicking::try
32: <F as threadpool::FnBox>::call_box
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 5:05:32 PM] Request textDocument/hover failed.
Message: server panicked: index out of bounds: the len is 1 but the index is 1
Code: -32603
Getting this error quite often when editing a proc macro of mine. Crashing every 30 seconds or a minute
In case anyone needs to try to reproduce, the macro is here https://github.com/cherryleafroad/kmagick-rs/tree/main/jni-macros
thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 1', crates\hir_def\src\nameres\path_resolution.rs:395:33
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 7:15:16 PM] Request textDocument/hover failed.
Message: server panicked: index out of bounds: the len is 1 but the index is 1
Code: -32603
thread '<unnamed>' panicked at 'index out of bounds: the len is 9 but the index is 14', crates\hir_def\src\nameres\path_resolution.rs:395:33
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Panic context:
>
version: 009e6ceb1 2021-09-27 stable
request: textDocument/hover HoverParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "/d%3A/Users/~/app/jni/kmagick-rs/jni-tools/src/lib.rs",
query: None,
fragment: None,
},
},
position: Position(
Position {
line: 20,
character: 89,
},
),
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
}
Out of curiosiosity, but does everyone here who ran into this issue before this monday have rust-analyzer.experimental.procAttrMacros enabled? For the people that have had this happen since this tuesday, are you running the nightly rust analyzer version?
I can't shake the feeling for some reason that this is attribute macro related so I wanna confirm this.
Out of curiosiosity, but does everyone here who ran into this issue before this monday have
rust-analyzer.experimental.procAttrMacrosenabled? For the people that have had this happen since this tuesday, are you running the nightly rust analyzer version?I can't shake the feeling for some reason that this is attribute macro related so I wanna confirm this.
I have rust-analyzer.procMacro.enable enabled and rust-analyzer.experimental.procAttrMacros disabled.
Just checked and I was on the stable channel.
I have the same as @cherryleafroad, rust-analyzer.procMacro.enable is on and rust-analyzer.experimental.procAttrMacros is off.
Also, I'm not sure if it's helpful, but for me the only times I've seen this error manifest is on types from the Standard Library. Hovering over a type from my own crate or a crate dependency works fine, but hovering over std types fails (I've seen it with String, Option, Arc, File, Command, OsString, AtomicBool, Ordering). Primitive types like f32, bool, and usize seem to work fine, as does hovering over a module name to get the module-level documentation. It's only the concrete types that cause issues.
It's only the concrete types that cause issues. That is because the actual panic occurs when fetching implementations of types(and traits), but I've also only seen this happen on std items so far, never on a workspace crate or other dependency.
If this helps anyone, it did this a lot to me (every single ctrl button press, literally) when I was ctrl+z'ing a lot of code. (In this case, ctrl+z was undoing one of my use statements)
It might also help to know that I set this option: "files.autoSave": "afterDelay",, which means it's going to be calling Rust Analyzer A LOT
Other options
"rust-analyzer.procMacro.enable": true,
"rust-analyzer.lens.references": true,
"rust-analyzer.hoverActions.references": true,
"rust-analyzer.experimental.procAttrMacros": true,
"rust-analyzer.checkOnSave.enable": true,
"rust-analyzer.diagnostics.enable": true,
"rust-analyzer.updates.channel": "nightly",
(note that most of these were different before and it was still happening; I was on stable, and diagnostics, checkon save, and procattrmacros were all off; all other ones were likely enabled all this time) - I have switched to nightly since then - not that it changed anything for me.
I have investigated this issue further and it does indeed look like a bug in salsa's interning code. Updating salsa to include https://github.com/salsa-rs/salsa/commit/f7dd6b3219b25a5cdc1ab09c94574a8c2432bbb7 does no longer trigger my assertions and should hopefully fix this issue too.
Hmm. I am still casually getting this panic (even with the fix in #10479). I wasn't able to reduce the code to something reproducable but I'll try...