rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.13k stars 1.58k forks source link

Rust Analyzer Crashes When Opening Continue Diff in VSCode #17335

Closed chrisoutwright closed 1 month ago

chrisoutwright commented 4 months ago

rust-analyzer version: rust-analyzer 0.3.1975-standalone (71a816a90 2024-05-26)

rustc version: rustc 1.63.0 (e4e8b5a6b 2023-06-30)

editor or extension: VSCode Version 1.89.1 (user setup) with Continue extension v0.8.38

relevant settings:

repository link (if public, optional):

code snippet to reproduce:

// Any code snippet will do, as the issue occurs when using the Continue extension to open the Continue Diff feature.
fn main() {
    println!("Hello, world!");
}

Description: When using the Continue extension in Visual Studio Code, attempting to open the Continue Diff feature causes Rust Analyzer to crash. The crash occurs specifically when performing the following steps:

  1. Highlight any code with Shift-Ctrl-L and choose the action /edit within the Continue panel.
  2. Wait for the Continue Diff to open.

At this point, the Rust Analyzer panics and crashes with the following error message:

thread 'LspServer' panicked at crates\paths\src\lib.rs:200:9:
assertion failed: path.is_absolute()

This issue results in the Rust Analyzer becoming unresponsive, and subsequent attempts to use its features fail. The error message indicates a problem with path handling in the Rust Analyzer. This issue only occurs when the Continue Diff is opened or left opened when restarting.

Log output:

thread 'LspServer' panicked at crates\paths\src\lib.rs:200:9:
assertion failed: path.is_absolute()
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\panicking.rs:645
   1: core::panicking::panic_fmt
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\core\src\panicking.rs:72
   2: core::panicking::panic
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\core\src\panicking.rs:145
   3: rust_analyzer::global_state::GlobalState::new
   4: rust_analyzer::main_loop::<impl rust_analyzer::global_state::GlobalState>::run
   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 '<unnamed>' panicked at C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\lsp-server-0.7.6\src\stdio.rs:28:37:
receiver was dropped, failed to send a message: "SendError(..)"
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\panicking.rs:645
   1: core::panicking::panic_fmt
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\core\src\panicking.rs:72
   2: core::result::unwrap_failed
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\core\src\result.rs:1654
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread 'main' panicked at C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\jod-thread-0.1.2\src\lib.rs:33:22:
called `Result::unwrap()` on an `Err` value: Any { .. }
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\panicking.rs:645
   1: core::panicking::panic_fmt
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\core\src\panicking.rs:72
   2: core::result::unwrap_failed
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\core\src\result.rs:1654
   3: stdx::thread::JoinHandle<T>::join
   4: lsp_types::trace::_::<impl serde::de::Deserialize for lsp_types::trace::TraceValue>::deserialize
   5: lsp_types::trace::_::<impl serde::de::Deserialize for lsp_types::trace::TraceValue>::deserialize
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 6:39:28 PM] Client Rust Analyzer Language Server: connection to server is erroring. Shutting down server.
[Error - 6:39:28 PM] Request textDocument/semanticTokens/range failed.
  Message: write EPIPE
  Code: -32099 
[Error - 6:39:28 PM] Stopping server failed
  Message: Cannot call write after a stream was destroyed
  Code: -32099 
[Error - 6:39:28 PM] Stopping server failed
  Message: Cannot call write after a stream was destroyed
  Code: -32099 
chrisoutwright commented 4 months ago

I tried:

"rust-analyzer.files.excludeDirs": [
  "C:\\Users\\chris\\.continue\\.diffs\\*",
  "C:\\Users\\chris\\.continue\\.diffs\\",
  "\\.continue\\.diffs\\",
  "/.continue/.diffs/"
]

Also I tried :

"files.watcherExclude": {
  "**/.continue/.diffs/**": true,
  "**/.continue/.diffs/*/**": true
}

but still happening. Settings wrong?

Veykril commented 4 months ago

Hmm, inling ate any useful backtrace information here.

chrisoutwright commented 4 months ago

In that example the path is: C:\Users\chris\.continue\.diffs\c:_b_Users_b_chris_b_rust_projects_b_cfg_parser_b_async_tutorials_b_ch05_b_framestack_tester_b_src_b_main.rs How can I prevent Rust Analyzer crashing? image

Veykril commented 4 months ago

That doesn't seem to be a valid windows path (: is not allowed in paths on windows, aside from the drive prefix), so I am not too surprised that things go bad here

Veykril commented 1 month ago

Closing this as this is not our issue