Skip to content

Out-of-bounds panics in Worker thread #16200

@holly-hacker

Description

@holly-hacker

rust-analyzer version: 0.4.1783-standalone (85fb463 2023-12-24)

rustc version: rustc 1.74.1 (a28077b28 2023-12-04)

relevant settings: n/a


Today when I started using rust-analyzer in a private project, I started getting a lot of errors out of nowhere when typing and hovering over text. The panic message is always an index out of bounds, and it happened on both the current release and current pre-release version of rust-analyzer.

thread 'Worker' panicked at C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\rust-analyzer-salsa-0.17.0-pre.4\src\interned.rs:107:32:
index out of bounds: the len is 85655 but the index is 4294967039
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library\std\src\panicking.rs:597
   1: core::panicking::panic_fmt
             at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library\core\src\panicking.rs:72
   2: core::panicking::panic_bounds_check
             at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library\core\src\panicking.rs:180
   3: salsa::QueryTable<Q>::get
   4: <DB as hir_expand::db::ExpandDatabase>::lookup_intern_syntax_context
   5: hir_expand::mod_path::resolve_crate_root
   6: hir_expand::mod_path::convert_path
   7: hir_expand::mod_path::convert_path
   8: hir_expand::mod_path::convert_path
   9: hir_expand::mod_path::convert_path
  10: hir_def::item_tree::lower::Ctx::lower_macro_call
  11: hir_def::item_tree::lower::Ctx::lower_mod_item
  12: hir_def::item_tree::ItemTree::file_item_tree_query
  13: salsa::Cycle::catch
  14: salsa::derived::slot::Slot<Q,MP>::evict
  15: salsa::derived::slot::Slot<Q,MP>::read
  16: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
  17: <DB as hir_def::db::DefDatabase>::file_item_tree
  18: hir_def::nameres::collector::DefCollector::record_resolved_import
  19: hir_def::data::StaticData::static_data_query
  20: hir_def::nameres::DefMap::block_def_map_query
  21: salsa::Cycle::catch
  22: salsa::derived::slot::Slot<Q,MP>::evict
  23: salsa::derived::slot::Slot<Q,MP>::read
  24: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
  25: <DB as hir_def::db::DefDatabase>::block_def_map
  26: hir_def::body::lower::ExprCollector::collect_stmt
  27: hir_def::body::lower::ExprCollector::maybe_collect_expr
  28: hir_def::body::lower::ExprCollector::collect_stmt
  29: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  30: hir_def::body::lower::ExprCollector::collect_stmt
  31: hir_def::body::lower::ExprCollector::maybe_collect_expr
  32: hir_def::body::lower::ExprCollector::collect_stmt
  33: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  34: hir_def::body::lower::ExprCollector::check_cfg
  35: hir_def::body::lower::ExprCollector::maybe_collect_expr
  36: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  37: <alloc::boxed::Box<[I]> as core::iter::traits::collect::FromIterator<I>>::from_iter
  38: hir_def::body::lower::ExprCollector::maybe_collect_expr
  39: hir_def::body::lower::ExprCollector::collect_stmt
  40: hir_def::body::lower::ExprCollector::maybe_collect_expr
  41: hir_def::body::lower::ExprCollector::collect_expr_opt
  42: hir_def::body::lower::lower
  43: hir_def::body::Body::body_with_source_map_query
  44: salsa::Cycle::catch
  45: salsa::derived::slot::Slot<Q,MP>::evict
  46: salsa::derived::slot::Slot<Q,MP>::read
  47: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
  48: hir::DefWithBody::diagnostics
  49: hir::ModuleDef::diagnostics
  50: hir::Module::diagnostics
  51: hir::DefWithBody::diagnostics
  52: hir::Module::diagnostics
  53: ide_diagnostics::diagnostics
  54: std::panicking::try
  55: ide::Analysis::assists_with_fixes
  56: rust_analyzer::handlers::request::handle_code_action
  57: std::panicking::try
  58: core::ops::function::FnOnce::call_once{{vtable.shim}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Panic context:
> 
version: 0.4.1783-standalone (85fb463fc 2023-12-24)
request: textDocument/semanticTokens/full/delta SemanticTokensDeltaParams {
    work_done_progress_params: WorkDoneProgressParams {
        work_done_token: None,
    },
    partial_result_params: PartialResultParams {
        partial_result_token: None,
    },
    text_document: TextDocumentIdentifier {
        uri: Url {
            scheme: "file",
            cannot_be_a_base: false,
            username: "",
            password: None,
            host: None,
            port: None,
            path: "/-snip-/src/routes/api.rs",
            query: None,
            fragment: None,
        },
    },
    previous_result_id: "2",
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Broken WindowBugs / technical debt to be addressed immediatelyC-bugCategory: bugE-easyE-has-instructionsIssue has some instructions and pointers to code to get started

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions