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

Rust Analyzer Crashes When Opening Continue Diff in VSCode #17335

Open
chrisoutwright opened this issue Jun 2, 2024 · 4 comments
Open

Rust Analyzer Crashes When Opening Continue Diff in VSCode #17335

chrisoutwright opened this issue Jun 2, 2024 · 4 comments
Labels
C-bug Category: bug

Comments

@chrisoutwright
Copy link

rust-analyzer version: rust-analyzer 0.3.1975-standalone (71a816a 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:

  • OS: Windows_NT x64 10.0.22631
  • LLM: Ollama self-hosted: codestral_22b-v0.1-q8_0

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 chrisoutwright added the C-bug Category: bug label Jun 2, 2024
@chrisoutwright
Copy link
Author

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
Copy link
Member

Veykril commented Jun 2, 2024

Hmm, inling ate any useful backtrace information here.

bors added a commit that referenced this issue Jun 2, 2024
Add path info to `AbsPathBuf::assert`'s assert

cc #17335
@chrisoutwright
Copy link
Author

chrisoutwright commented Jun 3, 2024

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
Copy link
Member

Veykril commented Jun 3, 2024

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

lnicola pushed a commit to lnicola/rust that referenced this issue Jun 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants