Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Popups about language server requests failing #15957

Closed
arvid-norlander opened this issue Nov 24, 2023 · 15 comments
Closed

Popups about language server requests failing #15957

arvid-norlander opened this issue Nov 24, 2023 · 15 comments
Labels
C-bug Category: bug I-panic

Comments

@arvid-norlander
Copy link

arvid-norlander commented Nov 24, 2023

Every few minutes I keep getting popups in VSCode about textDocument/documentHighlight, textDocument/inlayHint etc failing. The log shows the following:


thread 'Worker' panicked at crates/hir-def/src/attr.rs:368:40:
index out of bounds: the len is 4 but the index is 9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:597:5
   1: core::panicking::panic_fmt
             at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/panicking.rs:72:14
   2: core::panicking::panic_bounds_check
             at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/panicking.rs:180:5
   3: hir_def::attr::AttrsWithOwner::attrs_query
   4: salsa::runtime::Runtime::execute_query_implementation
   5: salsa::derived::slot::Slot<Q,MP>::read_upgrade
   6: salsa::derived::slot::Slot<Q,MP>::maybe_changed_since
   7: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::maybe_changed_since
   8: salsa::derived::slot::MemoRevisions::validate_memoized_value
   9: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  10: salsa::derived::slot::Slot<Q,MP>::read
  11: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  12: <DB as hir_def::db::DefDatabase>::import_map::__shim
  13: hir_def::find_path::calculate_best_path
  14: hir_def::find_path::find_path_for_module
  15: hir_def::find_path::calculate_best_path
  16: hir_def::find_path::find_path_inner
  17: hir_def::find_path::find_path
  18: <chalk_ir::Ty<hir_ty::interner::Interner> as hir_ty::display::HirDisplay>::hir_fmt
  19: hir_ty::display::HirDisplay::display_source_code
  20: ide::inlay_hints::ty_to_text_edit
  21: ide::inlay_hints::bind_pat::hints
  22: ide::inlay_hints::hints
  23: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  24: ide::inlay_hints::inlay_hints
  25: salsa::Cancelled::catch
  26: rust_analyzer::handlers::request::handle_inlay_hints
  27: std::panicking::try
  28: core::ops::function::FnOnce::call_once{{vtable.shim}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 11:57:44] Request textDocument/inlayHint failed.
  Message: request handler panicked: index out of bounds: the len is 4 but the index is 9
  Code: -32603 
Panic context:
> 
version: 0.3.1740-standalone
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/tmgarn/.rustup/toolchains/1.74.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs",
            query: None,
            fragment: None,
        },
    },
    position: Position(
        Position {
            line: 36,
            character: 10,
        },
    ),
    work_done_progress_params: WorkDoneProgressParams {
        work_done_token: None,
    },
}


thread 'Worker' panicked at crates/hir-def/src/nameres/path_resolution.rs:422:37:
index out of bounds: the len is 2 but the index is 2
stack backtrace:
   0: rust_begin_unwind
             at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:597:5
   1: core::panicking::panic_fmt
             at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/panicking.rs:72:14
   2: core::panicking::panic_bounds_check
             at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/panicking.rs:180:5
   3: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro_single
   4: hir_def::resolver::ModuleItemMap::resolve_path_in_type_ns
   5: hir_def::resolver::Resolver::resolve_path_in_type_ns
   6: hir_ty::lower::TyLoweringContext::lower_ty_ext
   7: hir_ty::lower::impl_self_ty_query
   8: salsa::runtime::Runtime::execute_query_implementation
   9: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  10: salsa::derived::slot::Slot<Q,MP>::read
  11: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  12: salsa::QueryTable<Q>::get
  13: <DB as hir_ty::db::HirDatabase>::impl_self_ty
  14: hir_ty::lower::impl_trait_query
  15: salsa::runtime::Runtime::execute_query_implementation
  16: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  17: salsa::derived::slot::Slot<Q,MP>::maybe_changed_since
  18: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::maybe_changed_since
  19: salsa::derived::slot::MemoRevisions::validate_memoized_value
  20: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  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_trait
  25: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
  26: <core::iter::adapters::flatten::Flatten<I> as core::iter::traits::iterator::Iterator>::next
  27: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  28: ide::goto_implementation::goto_implementation
  29: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
  30: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  31: rust_analyzer::handlers::request::handle_hover
  32: std::panicking::try
  33: core::ops::function::FnOnce::call_once{{vtable.shim}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 12:00:38] Request textDocument/hover failed.
  Message: request handler panicked: index out of bounds: the len is 2 but the index is 2
  Code: -32603 
Panic context:
> 
version: 0.3.1740-standalone
request: textDocument/documentHighlight DocumentHighlightParams {
    text_document_position_params: TextDocumentPositionParams {
        text_document: TextDocumentIdentifier {
            uri: Url {
                scheme: "file",
                cannot_be_a_base: false,
                username: "",
                password: None,
                host: None,
                port: None,
                path: "/home/tmgarn/workspace/acms_application_shell/services/web/backend/src/drillplan/models.rs",
                query: None,
                fragment: None,
            },
        },
        position: Position {
            line: 29,
            character: 66,
        },
    },
    work_done_progress_params: WorkDoneProgressParams {
        work_done_token: None,
    },
    partial_result_params: PartialResultParams {
        partial_result_token: None,
    },
}

thread 'Worker' panicked at /github/home/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rowan-0.15.11/src/cursor.rs:751:9:
Bad offset: range 0..800 offset 801
stack backtrace:
   0: rust_begin_unwind
             at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:597:5
   1: core::panicking::panic_fmt
             at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/panicking.rs:72:14
   2: rowan::cursor::SyntaxNode::token_at_offset
   3: ide::highlight_related::highlight_related
   4: std::panicking::try
   5: rust_analyzer::handlers::request::handle_document_highlight
   6: std::panicking::try
   7: core::ops::function::FnOnce::call_once{{vtable.shim}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 13:12:46] Request textDocument/documentHighlight failed.
  Message: request handler panicked: Bad offset: range 0..800 offset 801
  Code: -32603 

I don't know what exactly I'm doing to make it happen. I think possibly it happens when rebasing things in git in another terminal window sometimes? Sometimes when I'm reading documentation and not doing anything with the code. Sometimes when I'm writing or refactoring code.

It doesn't seem to me like anything is actually broken in the user experience. Apart from the popups themselves that is.

Unfortunately the code base I'm working on that is causing this is not open source (so I can't link it), but it is basically a graph QL micro service that makes GRPC requests as it's backend. It uses axum, tonic, prost, tower, async-graphql and tracing.

rust-analyzer version: 0.3.1740-standalone

rustc version: rustc 1.74.0 (79e9716c9 2023-11-13) (installed with rustup)

OS: Ubuntu 22.04, using KDE Plasma as my desktop environment

relevant settings: (eg. client settings, or environment variables like CARGO, RUSTC, RUSTUP_HOME or CARGO_HOME)

I am using the following workspace config (this is a mixed language project, only a small part is Rust currently, most of it is legacy C++ with CMake) as there is no Cargo.toml in the workspace root:

{
    "rust-analyzer.linkedProjects": [
        "services/web/backend/Cargo.toml"
    ]
}

In the user level VSCode settings I have:

    "rust-analyzer.diagnostics.warningsAsInfo": [
        "dead_code"
    ],
    "rust-analyzer.assist.emitMustUse": true,

(the former makes a lot of sense since I tend to write code bottom up and it gets annoying otherwise)

@arvid-norlander arvid-norlander added the C-bug Category: bug label Nov 24, 2023
@mmastrac
Copy link

mmastrac commented Dec 8, 2023

The same error happens when working on the open-source deno codebase. I often have both https://github.com/denoland/deno and https://github.com/denoland/deno_core checked out, and the language server will often crash with this error.


> impl_trait_query(ImplId(173247) -> ItemLoc { container: ModuleId { krate: Idx::<CrateData>(62), block: None, local_id: Idx::<ModuleData>(2) }, id: ItemTreeId { tree: TreeId { file: FileId(FileId(906)), block: None }, value: Idx::<Impl>(0) } } -> ImplData { target_trait: None, self_ty: Path(Normal { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("StrippedStr"))] }, generic_args: Some([Some(GenericArgs { args: [Lifetime(LifetimeRef { name: Name(Text("'s")) })], has_self_type: false, bindings: [], desugared_from_fn: false })]) }), items: [FunctionId(FunctionId(190416)), FunctionId(FunctionId(190417))], is_negative: false, is_unsafe: false, attribute_calls: None })

> impl_self_ty_query(ImplId(173247) -> ItemLoc { container: ModuleId { krate: Idx::<CrateData>(62), block: None, local_id: Idx::<ModuleData>(2) }, id: ItemTreeId { tree: TreeId { file: FileId(FileId(906)), block: None }, value: Idx::<Impl>(0) } } -> ImplData { target_trait: None, self_ty: Path(Normal { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("StrippedStr"))] }, generic_args: Some([Some(GenericArgs { args: [Lifetime(LifetimeRef { name: Name(Text("'s")) })], has_self_type: false, bindings: [], desugared_from_fn: false })]) }), items: [FunctionId(FunctionId(190416)), FunctionId(FunctionId(190417))], is_negative: false, is_unsafe: false, attribute_calls: None })

thread 'Worker' panicked at crates/hir-def/src/nameres/path_resolution.rs:422:37:
index out of bounds: the len is 2 but the index is 2
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::ModuleItemMap::resolve_path_in_type_ns
   5: hir_def::resolver::Resolver::resolve_path_in_type_ns
   6: hir_ty::lower::TyLoweringContext::lower_ty_ext
   7: hir_ty::lower::impl_self_ty_query
   8: salsa::runtime::Runtime::execute_query_implementation
   9: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  10: salsa::derived::slot::Slot<Q,MP>::read
  11: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  12: salsa::QueryTable<Q>::get
  13: <DB as hir_ty::db::HirDatabase>::impl_self_ty
  14: hir_ty::lower::impl_trait_query
  15: salsa::runtime::Runtime::execute_query_implementation
  16: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  17: salsa::derived::slot::Slot<Q,MP>::maybe_changed_since
  18: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::maybe_changed_since
  19: salsa::derived::slot::MemoRevisions::validate_memoized_value
  20: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  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: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  25: hir_ty::method_resolution::TraitImpls::trait_impls_in_deps_query
  26: salsa::runtime::Runtime::execute_query_implementation
  27: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  28: salsa::derived::slot::Slot<Q,MP>::read
  29: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  30: salsa::QueryTable<Q>::get
  31: <DB as hir_ty::db::HirDatabase>::trait_impls_in_deps
  32: hir_ty::chalk_db::<impl chalk_solve::RustIrDatabase<hir_ty::interner::Interner> for hir_ty::traits::ChalkContext>::impls_for_trait
  33: chalk_solve::clauses::program_clauses_that_could_match
  34: chalk_recursive::solve::SolveIterationHelpers::solve_from_clauses
  35: chalk_recursive::solve::SolveIteration::solve_iteration
  36: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  37: <chalk_recursive::recursive::RecursiveSolver<I> as chalk_solve::solve::Solver<I>>::solve_limited
  38: hir_ty::traits::solve::{{closure}}
  39: hir_ty::traits::trait_solve_query
  40: salsa::runtime::Runtime::execute_query_implementation
  41: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  42: salsa::derived::slot::Slot<Q,MP>::read
  43: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  44: salsa::QueryTable<Q>::get
  45: <DB as hir_ty::db::HirDatabase>::trait_solve_query
  46: hir_ty::db::trait_solve_wait
  47: hir_ty::infer::unify::InferenceTable::try_obligation
  48: hir_ty::autoderef::deref_by_trait
  49: hir_ty::autoderef::autoderef_step
  50: <hir_ty::autoderef::Autoderef as core::iter::traits::iterator::Iterator>::next
  51: hir_ty::method_resolution::autoderef_method_receiver
  52: hir_ty::method_resolution::iterate_method_candidates_dyn
  53: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
  54: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr
  55: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
  56: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_coerce
  57: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_block
  58: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
  59: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_coerce
  60: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_block
  61: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
  62: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_return
  63: hir_ty::infer::infer_query
  64: salsa::runtime::Runtime::execute_query_implementation
  65: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  66: salsa::derived::slot::Slot<Q,MP>::read
  67: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  68: <DB as hir_ty::db::HirDatabase>::infer_query::__shim
  69: hir_ty::db::infer_wait
  70: hir::source_analyzer::SourceAnalyzer::new_for_body
  71: hir::semantics::SemanticsImpl::analyze_impl
  72: ide_db::defs::NameRefClass::classify
  73: ide_db::search::FindUsages::found_name_ref
  74: ide_db::search::FindUsages::search
  75: ide_assists::handlers::inline_call::inline_into_callers
  76: ide_assists::assists
  77: std::panicking::try
  78: ide::Analysis::assists_with_fixes
  79: rust_analyzer::handlers::request::handle_code_action
  80: std::panicking::try
  81: core::ops::function::FnOnce::call_once{{vtable.shim}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@bonsairobo
Copy link

bonsairobo commented Dec 13, 2023

+1 to @mmastrac

Looks like my server is panicking when trying to execute a query for fixedbitset.

2023-12-12T18:40:58.936 helix_lsp::transport [ERROR] err <- "> impl_trait_query(ImplId(13612) -> ItemLoc { container: ModuleId { krate: Idx::<CrateData>(276), block: None, local_id: Idx::<ModuleData>(3) }, id: ItemTreeId { tree: TreeId { file: FileId(FileId(7287)), block: None }, value: Idx::<Impl>(0) } } -> ImplData { target_trait: None, self_ty: Path(Normal { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text(\"Config\"))] }, generic_args: None }), items: [FunctionId(FunctionId(87465)), FunctionId(FunctionId(87466)), FunctionId(FunctionId(87467)), FunctionId(FunctionId(87468)), FunctionId(FunctionId(87469)), FunctionId(FunctionId(87470)), FunctionId(FunctionId(87471)), FunctionId(FunctionId(87472)), FunctionId(FunctionId(87473)), FunctionId(FunctionId(87474))], is_negative: false, attribute_calls: None })\n"
2023-12-12T18:40:58.936 helix_lsp::transport [ERROR] err <- "\n"
2023-12-12T18:40:58.936 helix_lsp::transport [ERROR] err <- "> impl_self_ty_query(ImplId(13612) -> ItemLoc { container: ModuleId { krate: Idx::<CrateData>(276), block: None, local_id: Idx::<ModuleData>(3) }, id: ItemTreeId { tree: TreeId { file: FileId(FileId(7287)), block: None }, value: Idx::<Impl>(0) } } -> ImplData { target_trait: None, self_ty: Path(Normal { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text(\"Config\"))] }, generic_args: None }), items: [FunctionId(FunctionId(87465)), FunctionId(FunctionId(87466)), FunctionId(FunctionId(87467)), FunctionId(FunctionId(87468)), FunctionId(FunctionId(87469)), FunctionId(FunctionId(87470)), FunctionId(FunctionId(87471)), FunctionId(FunctionId(87472)), FunctionId(FunctionId(87473)), FunctionId(FunctionId(87474))], is_negative: false, attribute_calls: None })\n"
2023-12-12T18:40:58.936 helix_lsp::transport [ERROR] err <- "\n"
2023-12-12T18:40:58.936 helix_lsp::transport [ERROR] err <- "> DefMap Idx::<CrateData>(276) crate_name=Some(CrateDisplayName { crate_name: CrateName(\"fixedbitset\"), canonical_name: \"fixedbitset\" }) block=None path=Config\n"
2023-12-12T18:40:58.936 helix_lsp::transport [ERROR] err <- "\n"
2023-12-12T18:40:58.936 helix_lsp::transport [ERROR] err <- "thread 'Worker' panicked at crates/hir-def/src/nameres/path_resolution.rs:431:37:\n"
2023-12-12T18:40:58.936 helix_lsp::transport [ERROR] err <- "index out of bounds: the len is 2 but the index is 3\n"
2023-12-12T18:40:58.936 helix_lsp::transport [ERROR] err <- "stack backtrace:\n"
2023-12-12T18:40:58.942 helix_lsp::transport [ERROR] err <- "   0: rust_begin_unwind\n"
2023-12-12T18:40:58.942 helix_lsp::transport [ERROR] err <- "             at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panicking.rs:597:5\n"
2023-12-12T18:40:58.942 helix_lsp::transport [ERROR] err <- "   1: core::panicking::panic_fmt\n"
2023-12-12T18:40:58.942 helix_lsp::transport [ERROR] err <- "             at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/panicking.rs:72:14\n"
2023-12-12T18:40:58.942 helix_lsp::transport [ERROR] err <- "   2: core::panicking::panic_bounds_check\n"
2023-12-12T18:40:58.942 helix_lsp::transport [ERROR] err <- "             at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/panicking.rs:180:5\n"
2023-12-12T18:40:58.942 helix_lsp::transport [ERROR] err <- "   3: <hir_def::nameres::DefMap>::resolve_path_fp_with_macro_single\n"
2023-12-12T18:40:58.942 helix_lsp::transport [ERROR] err <- "   4: <hir_def::resolver::ModuleItemMap>::resolve_path_in_type_ns\n"
2023-12-12T18:40:58.942 helix_lsp::transport [ERROR] err <- "   5: <hir_def::resolver::Resolver>::resolve_path_in_type_ns\n"
2023-12-12T18:40:58.942 helix_lsp::transport [ERROR] err <- "   6: <hir_ty::lower::TyLoweringContext>::lower_ty_ext\n"
2023-12-12T18:40:58.942 helix_lsp::transport [ERROR] err <- "   7: hir_ty::lower::impl_self_ty_query\n"
2023-12-12T18:40:58.942 helix_lsp::transport [ERROR] err <- "   8: <salsa::runtime::Runtime>::execute_query_implementation::<dyn hir_ty::db::HirDatabase, chalk_ir::Binders<chalk_ir::Ty<hir_ty::interner::Interner>>, <salsa::derived::slot::Slot<hir_ty::db::ImplSelfTyQuery, salsa::derived::AlwaysMemoizeValue>>::read_upgrade::{closure#0}>\n"
2023-12-12T18:40:58.942 helix_lsp::transport [ERROR] err <- "   9: <salsa::derived::slot::Slot<hir_ty::db::ImplSelfTyQuery, salsa::derived::AlwaysMemoizeValue>>::read_upgrade\n"
2023-12-12T18:40:58.942 helix_lsp::transport [ERROR] err <- "  10: <salsa::derived::slot::Slot<hir_ty::db::ImplSelfTyQuery, salsa::derived::AlwaysMemoizeValue>>::read\n"
2023-12-12T18:40:58.942 helix_lsp::transport [ERROR] err <- "  11: <salsa::derived::DerivedStorage<hir_ty::db::ImplSelfTyQuery, salsa::derived::AlwaysMemoizeValue> as salsa::plumbing::QueryStorageOps<hir_ty::db::ImplSelfTyQuery>>::try_fetch\n"
2023-12-12T18:40:58.942 helix_lsp::transport [ERROR] err <- "  12: <salsa::QueryTable<hir_ty::db::ImplSelfTyQuery>>::get\n"
2023-12-12T18:40:58.942 helix_lsp::transport [ERROR] err <- "  13: <_ as hir_ty::db::HirDatabase>::impl_self_ty::__shim\n"
2023-12-12T18:40:58.942 helix_lsp::transport [ERROR] err <- "  14: hir_ty::lower::impl_trait_query\n"
2023-12-12T18:40:58.942 helix_lsp::transport [ERROR] err <- "  15: <salsa::runtime::Runtime>::execute_query_implementation::<dyn hir_ty::db::HirDatabase, core::option::Option<chalk_ir::Binders<chalk_ir::TraitRef<hir_ty::interner::Interner>>>, <salsa::derived::slot::Slot<hir_ty::db::ImplTraitQuery, salsa::derived::AlwaysMemoizeValue>>::read_upgrade::{closure#0}>\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  16: <salsa::derived::slot::Slot<hir_ty::db::ImplTraitQuery, salsa::derived::AlwaysMemoizeValue>>::read_upgrade\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  17: <salsa::derived::slot::Slot<hir_ty::db::ImplTraitQuery, salsa::derived::AlwaysMemoizeValue>>::maybe_changed_since\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  18: <salsa::derived::DerivedStorage<hir_ty::db::ImplTraitQuery, salsa::derived::AlwaysMemoizeValue> as salsa::plumbing::QueryStorageOps<hir_ty::db::ImplTraitQuery>>::maybe_changed_since\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  19: <salsa::derived::slot::MemoRevisions>::validate_memoized_value\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  20: <salsa::derived::slot::Slot<hir_ty::db::TraitImplsInCrateQuery, salsa::derived::AlwaysMemoizeValue>>::read_upgrade\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  21: <salsa::derived::slot::Slot<hir_ty::db::TraitImplsInCrateQuery, salsa::derived::AlwaysMemoizeValue>>::read\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  22: <salsa::derived::DerivedStorage<hir_ty::db::TraitImplsInCrateQuery, salsa::derived::AlwaysMemoizeValue> as salsa::plumbing::QueryStorageOps<hir_ty::db::TraitImplsInCrateQuery>>::try_fetch\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  23: <_ as hir_ty::db::HirDatabase>::trait_impls_in_crate::__shim\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  24: <alloc::vec::Vec<triomphe::arc::Arc<hir_ty::method_resolution::TraitImpls>> as alloc::vec::spec_from_iter::SpecFromIter<triomphe::arc::Arc<hir_ty::method_resolution::TraitImpls>, core::iter::adapters::map::Map<std::collections::hash::set::IntoIter<la_arena::Idx<base_db::input::CrateData>>, <hir_ty::method_resolution::TraitImpls>::trait_impls_in_deps_query::{closure#1}>>>::from_iter\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  25: <hir_ty::method_resolution::TraitImpls>::trait_impls_in_deps_query\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  26: <salsa::runtime::Runtime>::execute_query_implementation::<dyn hir_ty::db::HirDatabase, triomphe::arc::Arc<[triomphe::arc::Arc<hir_ty::method_resolution::TraitImpls>]>, <salsa::derived::slot::Slot<hir_ty::db::TraitImplsInDepsQuery, salsa::derived::AlwaysMemoizeValue>>::read_upgrade::{closure#0}>\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  27: <salsa::derived::slot::Slot<hir_ty::db::TraitImplsInDepsQuery, salsa::derived::AlwaysMemoizeValue>>::read_upgrade\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  28: <salsa::derived::slot::Slot<hir_ty::db::TraitImplsInDepsQuery, salsa::derived::AlwaysMemoizeValue>>::read\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  29: <salsa::derived::DerivedStorage<hir_ty::db::TraitImplsInDepsQuery, salsa::derived::AlwaysMemoizeValue> as salsa::plumbing::QueryStorageOps<hir_ty::db::TraitImplsInDepsQuery>>::try_fetch\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  30: <salsa::QueryTable<hir_ty::db::TraitImplsInDepsQuery>>::get\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  31: <_ as hir_ty::db::HirDatabase>::trait_impls_in_deps::__shim\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  32: <hir_ty::traits::ChalkContext as chalk_solve::RustIrDatabase<hir_ty::interner::Interner>>::impls_for_trait\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  33: chalk_solve::clauses::program_clauses_that_could_match::<hir_ty::interner::Interner>\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  34: <chalk_recursive::recursive::Solver<hir_ty::interner::Interner> as chalk_recursive::solve::SolveIteration<hir_ty::interner::Interner>>::solve_iteration::<&dyn core::ops::function::Fn<(), Output = bool>>\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  35: <chalk_recursive::fixed_point::RecursiveContext<chalk_ir::UCanonical<chalk_ir::InEnvironment<chalk_ir::Goal<hir_ty::interner::Interner>>>, core::result::Result<chalk_solve::solve::Solution<hir_ty::interner::Interner>, chalk_ir::NoSolution>>>::solve_goal::<&dyn chalk_solve::RustIrDatabase<hir_ty::interner::Interner>, &dyn core::ops::function::Fn<(), Output = bool>>\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  36: <chalk_recursive::recursive::RecursiveSolver<hir_ty::interner::Interner> as chalk_solve::solve::Solver<hir_ty::interner::Interner>>::solve_limited\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  37: hir_ty::traits::solve::{closure#1}\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  38: hir_ty::traits::trait_solve_query\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  39: <salsa::runtime::Runtime>::execute_query_implementation::<dyn hir_ty::db::HirDatabase, core::option::Option<chalk_solve::solve::Solution<hir_ty::interner::Interner>>, <salsa::derived::slot::Slot<hir_ty::db::TraitSolveQueryQuery, salsa::derived::AlwaysMemoizeValue>>::read_upgrade::{closure#0}>\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  40: <salsa::derived::slot::Slot<hir_ty::db::TraitSolveQueryQuery, salsa::derived::AlwaysMemoizeValue>>::read_upgrade\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  41: <salsa::derived::slot::Slot<hir_ty::db::TraitSolveQueryQuery, salsa::derived::AlwaysMemoizeValue>>::read\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  42: <salsa::derived::DerivedStorage<hir_ty::db::TraitSolveQueryQuery, salsa::derived::AlwaysMemoizeValue> as salsa::plumbing::QueryStorageOps<hir_ty::db::TraitSolveQueryQuery>>::try_fetch\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  43: <salsa::QueryTable<hir_ty::db::TraitSolveQueryQuery>>::get\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  44: <_ as hir_ty::db::HirDatabase>::trait_solve_query::__shim\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  45: <ide_db::RootDatabase as hir_ty::db::HirDatabase>::trait_solve_query\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  46: hir_ty::db::trait_solve_wait\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  47: <ide_db::RootDatabase as hir_ty::db::HirDatabase>::trait_solve\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  48: <hir_ty::infer::unify::InferenceTable>::try_obligation\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  49: hir_ty::autoderef::deref_by_trait\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  50: hir_ty::autoderef::autoderef_step\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  51: <hir_ty::autoderef::Autoderef as core::iter::traits::iterator::Iterator>::next\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  52: hir_ty::method_resolution::autoderef_method_receiver\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  53: hir_ty::method_resolution::iterate_method_candidates_dyn\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  54: <hir_ty::infer::InferenceContext>::infer_expr_inner\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  55: <hir_ty::infer::InferenceContext>::infer_expr\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  56: <hir_ty::infer::InferenceContext>::infer_block\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  57: <hir_ty::infer::InferenceContext>::infer_expr_inner\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  58: <hir_ty::infer::InferenceContext>::infer_return\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  59: hir_ty::infer::infer_query\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  60: <salsa::runtime::Runtime>::execute_query_implementation::<dyn hir_ty::db::HirDatabase, triomphe::arc::Arc<hir_ty::infer::InferenceResult>, <salsa::derived::slot::Slot<hir_ty::db::InferQueryQuery, salsa::derived::AlwaysMemoizeValue>>::read_upgrade::{closure#0}>\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  61: <salsa::derived::slot::Slot<hir_ty::db::InferQueryQuery, salsa::derived::AlwaysMemoizeValue>>::read_upgrade\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  62: <salsa::derived::slot::Slot<hir_ty::db::InferQueryQuery, salsa::derived::AlwaysMemoizeValue>>::read\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  63: <salsa::derived::DerivedStorage<hir_ty::db::InferQueryQuery, salsa::derived::AlwaysMemoizeValue> as salsa::plumbing::QueryStorageOps<hir_ty::db::InferQueryQuery>>::try_fetch\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  64: <_ as hir_ty::db::HirDatabase>::infer_query::__shim\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  65: hir_ty::db::infer_wait\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  66: <hir::DefWithBody>::diagnostics\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  67: <hir::Module>::diagnostics\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  68: ide_diagnostics::diagnostics\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  69: <salsa::Cancelled>::catch::<<ide::Analysis>::with_db<<ide::Analysis>::diagnostics::{closure#0}, alloc::vec::Vec<ide_diagnostics::Diagnostic>>::{closure#0}, alloc::vec::Vec<ide_diagnostics::Diagnostic>>\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  70: <ide::Analysis>::diagnostics\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  71: <&mut rust_analyzer::diagnostics::fetch_native_diagnostics::{closure#0} as core::ops::function::FnMut<(vfs::FileId,)>>::call_mut\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  72: <alloc::vec::Vec<(vfs::FileId, alloc::vec::Vec<lsp_types::Diagnostic>)> as alloc::vec::spec_from_iter::SpecFromIter<(vfs::FileId, alloc::vec::Vec<lsp_types::Diagnostic>), core::iter::adapters::filter_map::FilterMap<alloc::vec::into_iter::IntoIter<vfs::FileId>, rust_analyzer::diagnostics::fetch_native_diagnostics::{closure#0}>>>::from_iter\n"
2023-12-12T18:40:58.943 helix_lsp::transport [ERROR] err <- "  73: <<stdx::thread::pool::Pool>::spawn<<rust_analyzer::task_pool::TaskPool<rust_analyzer::main_loop::Task>>::spawn<<rust_analyzer::global_state::GlobalState>::update_diagnostics::{closure#2}>::{closure#0}>::{closure#0} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}\n"

@Veykril
Copy link
Member

Veykril commented Dec 13, 2023

That is a known issue (we still haven;t found the root cause), usually happens when you add a new dependency. It should suffice to restart the server when you encounter that. (therefor rebasing can definitely cause this as well)

@lnicola
Copy link
Member

lnicola commented Dec 13, 2023

It may also happen if you start typing right after opening a project.

@bonsairobo
Copy link

bonsairobo commented Dec 13, 2023

@Veykril

It should suffice to restart the server when you encounter that.

It doesn't seem to help. This has been happening repeatedly for weeks.

@Veykril
Copy link
Member

Veykril commented Dec 13, 2023

Then we'll need to see a repro, to us this is only known as the bug I've described so far.

@arvid-norlander
Copy link
Author

arvid-norlander commented Dec 14, 2023

I keep having this issue (and restarting the language server or vscode doesn't help). It seems to be possibly related to generated files from prost (a library that generates bindings for protobuf/grpc files). At least rust-analyzer isn't able to complete anything from within those generated files. However rust seems unable to show the hover docs box even for some built in types (specifically &str and String) though others work fine (e.g. Option).

But unfortunately the code base is closed source, I will try to find some time to make a smaller test case though. Probably won't happen for a couple of weeks though.

@arvid-norlander
Copy link
Author

arvid-norlander commented Dec 14, 2023

Actually I did a quick try and you don't need much to get the issues. Attached is a tar.gz of a project that causes the issues. Open the project with vscode and Rust-Analyzer and observe the issues described in comments in main.rs.

Notes:

  • The issues observed are very sensitive to what dependencies are in Cargo.toml. I did not really manage to reduce that list. It would vary wildly with which types would cause failures just by simple changes such as removing anyhow! I thus gave up on trying to minimize the dependency list.
  • I tried disabling all vscode extensions except Rust-Analyzer and reloading, it did change behaviour, but only in part. Now hover on Option (first example) works again. The others are still broken.

System info

rust-analyzer version: 0.3.1766-standalone

$ code --version
1.85.1
0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2
x64
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.3 LTS
Release:        22.04
Codename:       jammy
$ uname -a
Linux ubuntu-tmgarn 6.2.0-37-generic #38~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov  2 18:01:13 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
$ cat ~/.cargo/config.toml                                                             
[net]
git-fetch-with-cli = true
[build]
rustc-wrapper = "/home/tmgarn/.cargo/bin/sccache"
  • This is real Linux, not WSL stuff
  • Sccache is set up to use azure blob storage

Finally, here is the project: reproducer.tar.gz

@arvid-norlander
Copy link
Author

@Veykril Hi! Did you have time to look at the repro I uploaded? Would be good to know if it reproduces the issue for you too, and that it is not just an issue on my computer.

@lnicola
Copy link
Member

lnicola commented Jan 8, 2024

I can't reproduce the first two issues. The third one happens for me, but it's unrelated (looks like we can't find company_name.network.v1.rs for some reason).

But I suspect the second one is timing-dependent.

@arvid-norlander
Copy link
Author

@lnicola Ouch, such issues are annoying.

The third one happens for me, but it's unrelated (looks like we can't find company_name.network.v1.rs for some reason).

This was actually the first major problem (apart from the error popups) that I noticed from this case. It worked just fine in early november, so it broke since then. But you are saying that is a separate bug apart from the error popups? But the issue doesn't happen in a project without prost generating files, so I would say it is deeply related.

@lnicola
Copy link
Member

lnicola commented Jan 8, 2024

I think there were some changes (improvements?) to include! handling around that time. But yeah, it appears to be a different issue.

@Veykril
Copy link
Member

Veykril commented Jan 8, 2024

There is a known regression wrt to include! #16109 which is caused by the tokenmap rewrite, but i haven't looked into it yet.

@Veykril
Copy link
Member

Veykril commented Jul 7, 2024

The main issue reported is likely the known salsa issue, the include one has been fixed

@Veykril Veykril closed this as completed Jul 7, 2024
@yebei199
Copy link

now have same question :Request textDocument/inlayHint failed. 😭

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug I-panic
Projects
None yet
Development

No branches or pull requests

6 participants