Skip to content

[rust-analyzer 0.3.2575-standalone] rust-analyzer panics with "index out of bounds" in diagnostics.rs #20433

@forestaa

Description

@forestaa

I updated the rust-analyzer, then it panics with the following error:

thread 'LspServer' panicked at crates/rust-analyzer/src/diagnostics.rs:108:22:
index out of bounds: the len is 0 but the index is 0
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic_bounds_check
   3: rust_analyzer::diagnostics::DiagnosticCollection::clear_check_older_than
   4: rust_analyzer::main_loop::<impl rust_analyzer::global_state::GlobalState>::handle_event
   5: rust_analyzer::main_loop::<impl rust_analyzer::global_state::GlobalState>::run
   6: rust_analyzer::main_loop::main_loop
   7: rust_analyzer::run_server
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

thread 'main' panicked at /github/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/jod-thread-1.0.0/src/lib.rs:33:22:
called `Result::unwrap()` on an `Err` value: Any { .. }
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: stdx::thread::JoinHandle<T>::join
   4: rust_analyzer::with_extra_thread
   5: rust_analyzer::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 10:42:03 PM] The Rust Analyzer Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
[Error - 10:42:03 PM] Server process exited with code 101.

rust-analyzer version: rust-analyzer version: 0.3.2575-standalone

rustc version: rustc 1.91.0-nightly (c8ca44c98 2025-08-10)

editor or extension: VSCode 1.103.0 extension version 0.3.2575

relevant settings:

repository link (if public, optional): private repo

code snippet to reproduce:

  1. Open the project in Visual Studio Code.
  2. rust-analyzer panics with the error.

I tried to find a minimal reproducible examples, but I can't.
What information should I provide?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-flycheckissues with flycheck a.k.a. "check on save"C-bugCategory: bugI-panic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions