[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
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.
Yeah, I’ve looked at the code in
hir_defand 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_defis causing the problem. Almost as if the data interned in the salsa database gets corrupted or mixed up somehow.It was a git repo, with only main.
latest version of rust, rust-analyzer.
Switched to pre-release
Error
But it’s OK if I create a new repo…
To give a short update on this: I think I roughly know what’s happening now, and I’ve posted my findings on the salsa Zulip, where I hope we’ll figure out what the intended behavior of salsa is, and how to prevent similar bugs in the future (since this was quite the nightmare to debug).
I have
rust-analyzer.procMacro.enableenabled andrust-analyzer.experimental.procAttrMacrosdisabled.Just checked and I was on the stable channel.
Got the panic again, dump:
Repo at or right after the crash: https://github.com/ruma/ruma/tree/ra-panic-2021-09-12
I’ve added some more logging in #10159, so please post another panic message when you encounter this again
Just ran into this while hacking on salsa:
And managed to reproduce this once by hovering over
Identhere, but a subsequent server restart made it no longer reproduce…I have no idea why hovering over anything in
on_demand_inputs.rswould make us try to resolveIdentthough.