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

":RustLsp flyCheck clear" crahes rust-analyzer #465

Closed
6 of 7 tasks
jannes opened this issue Jul 31, 2024 · 6 comments · Fixed by #477
Closed
6 of 7 tasks

":RustLsp flyCheck clear" crahes rust-analyzer #465

jannes opened this issue Jul 31, 2024 · 6 comments · Fixed by #477
Labels

Comments

@jannes
Copy link
Contributor

jannes commented Jul 31, 2024

Have you read the docs and searched existing issues?

Neovim version (nvim -v)

v0.10.0

Operating system/version

MacOS 13.6.6

Output of :checkhealth rustaceanvim

rustaceanvim: require("rustaceanvim.health").check()

Checking for Lua dependencies ~
- WARNING dap not installed. Needed for debugging features [mfussenegger/nvim-dap](https://github.com/mfussenegger/nvim-dap)

Checking external dependencies ~
- OK rust-analyzer: found rust-analyzer 0.3.2053-standalone (fd74511f3 2024-07-28)
- OK Cargo: found cargo 1.80.0 (376290515 2024-07-16)
- OK rustc: found rustc 1.80.0 (051478957 2024-07-21)

Checking config ~
- OK No errors found in config.

Checking for conflicting plugins ~
- OK No conflicting plugins detected.

Checking for tree-sitter parser ~
- WARNING No tree-sitter parser for Rust detected. Required by 'Rustc unpretty' command.

How to reproduce the issue

cargo new --bin repro
cd repro
nvim -u <path_to_minimal_config> src/main.rs
# then in nvim:
:RustLsp flyCheck run
:RustLsp flycheck clear`

Expected behaviour

no failure and clippy diagnostics to be cleared from all buffers

Actual behaviour

Client rust-analyzer quit with exit code 101 and signal 0.

logs:

[START][2024-07-31 15:07:01] LSP logging initiated
[ERROR][2024-07-31 15:07:01] .../vim/lsp/rpc.lua:770	"rpc"	"rust-analyzer"	"stderr"	"thread 'LspServer' panicked at crates/rust-analyzer/src/dispatch.rs:308:17:\nInvalid request\nMethod: rust-analyzer/clearFlycheck\n error: invalid type: sequence, expected unit\n"
[ERROR][2024-07-31 15:07:01] .../vim/lsp/rpc.lua:770	"rpc"	"rust-analyzer"	"stderr"	"stack backtrace:\n   0: _rust_begin_unwind\n   1: core::panicking::panic_fmt\n"
[ERROR][2024-07-31 15:07:01] .../vim/lsp/rpc.lua:770	"rpc"	"rust-analyzer"	"stderr"	"   2: rust_analyzer::dispatch::NotificationDispatcher::on_sync_mut\n"
[ERROR][2024-07-31 15:07:01] .../vim/lsp/rpc.lua:770	"rpc"	"rust-analyzer"	"stderr"	"   3: "
[ERROR][2024-07-31 15:07:01] .../vim/lsp/rpc.lua:770	"rpc"	"rust-analyzer"	"stderr"	"rust_analyzer::main_loop::<impl rust_analyzer::global_state::GlobalState>::handle_event\n   4: rust_analyzer::main_loop::<impl rust_analyzer::global_state::GlobalState>::run\n"
[ERROR][2024-07-31 15:07:01] .../vim/lsp/rpc.lua:770	"rpc"	"rust-analyzer"	"stderr"	"   5: rust_analyzer::main_loop::main_loop\n"
[ERROR][2024-07-31 15:07:01] .../vim/lsp/rpc.lua:770	"rpc"	"rust-analyzer"	"stderr"	"   6: rust_analyzer::run_server\nnote: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.\n"
[ERROR][2024-07-31 15:07:02] .../vim/lsp/rpc.lua:770	"rpc"	"rust-analyzer"	"stderr"	"thread 'main' panicked at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jod-thread-0.1.2/src/lib.rs:33:"
[ERROR][2024-07-31 15:07:02] .../vim/lsp/rpc.lua:770	"rpc"	"rust-analyzer"	"stderr"	"22:\ncalled `Result::unwrap()` on an `Err` value: Any { .. }\nstack backtrace:\n   0: _rust_begin_unwind\n   1: core::panicking::panic_fmt\n   2: core::result::unwrap_failed\n   3: stdx::thread::JoinHandle<T>::join\n   4: rust_analyzer::with_extra_thread\n   5: rust_analyzer::main\n"
[ERROR][2024-07-31 15:07:02] .../vim/lsp/rpc.lua:770	"rpc"	"rust-analyzer"	"stderr"	"note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.\n"

The minimal config used to reproduce this issue.

vim.env.LAZY_STDPATH = '.repro'
load(vim.fn.system('curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua'))()

require('lazy.minit').repro {
  spec = {
    {
      'mrcjkb/rustaceanvim',
      version = '^5',
      init = function()
        -- Configure rustaceanvim here
        vim.g.rustaceanvim = {}
      end,
      lazy = false,
    },
  },
}
@jannes jannes added the bug Something isn't working label Jul 31, 2024
@jannes jannes changed the title ":RustLsp flyCheck cancel" crahes rust-analyzer ":RustLsp flyCheck clear" crahes rust-analyzer Jul 31, 2024
@jannes
Copy link
Contributor Author

jannes commented Jul 31, 2024

cancel subcommand also crashes with logs:

[START][2024-07-31 14:27:51] LSP logging initiated
[ERROR][2024-07-31 14:27:51] .../vim/lsp/rpc.lua:770	"rpc"	"rust-analyzer"	"stderr"	"thread 'LspServer' panicked at crates/rust-analyzer/src/dispatch.rs:308:17:\nInvalid request\nMethod: rust-analyzer/cancelFlycheck\n error: invalid type: sequence, expected unit\nstack backtrace:\n   0: _rust_begin_unwind\n   1: core::panicking::panic_fmt\n   2: rust_analyzer::dispatch::NotificationDispatcher::on_sync_mut\n   3: rust_analyzer::main_loop::<impl rust_analyzer::global_state::GlobalState>::handle_event\n   4: rust_analyzer::main_loop::<impl rust_analyzer::global_state::GlobalState>::run\n   5: rust_analyzer::main_loop::main_loop\n   6: rust_analyzer::run_server\nnote: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.\n"
[ERROR][2024-07-31 14:27:53] .../vim/lsp/rpc.lua:770	"rpc"	"rust-analyzer"	"stderr"	"thread 'main' panicked at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jod-thread-0.1.2/src/lib.rs:33:22:\ncalled `Result::unwrap()` on an `Err` value: Any { .. }\n"
[ERROR][2024-07-31 14:27:53] .../vim/lsp/rpc.lua:770	"rpc"	"rust-analyzer"	"stderr"	"stack backtrace:\n   0: _rust_begin_unwind\n   1: core::panicking::panic_fmt\n   2: core::result::unwrap_failed\n   3: stdx::thread::JoinHandle<T>::join\n   4: rust_analyzer::with_extra_thread\n   5: rust_analyzer::main\n"
[ERROR][2024-07-31 14:27:53] .../vim/lsp/rpc.lua:770	"rpc"	"rust-analyzer"	"stderr"	"note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.\n"

@jannes
Copy link
Contributor Author

jannes commented Jul 31, 2024

could be related, but has been fixed for latest rust-analyzer that I am using: rust-lang/rust-analyzer#17445

@mrcjkb
Copy link
Owner

mrcjkb commented Aug 1, 2024

Hey 👋

Closing, since this is a rust-analyzer bug.
There's nothing I can do here. Please open an issue in the rust-analyzer repo.

@mrcjkb mrcjkb closed this as not planned Won't fix, can't repro, duplicate, stale Aug 1, 2024
@mrcjkb mrcjkb added upstream and removed bug Something isn't working labels Aug 1, 2024
@jannes
Copy link
Contributor Author

jannes commented Aug 1, 2024

could you help me with some pointers for a editor-agnostic repro though? or do you think they accept a vscode example? anyways, thank you :)

@mrcjkb
Copy link
Owner

mrcjkb commented Aug 2, 2024

Rustaceanvim only sends a rust-analyzer/clearFlycheck request to rust-analyzer, so this should be reproducible in any editor.

@jannes
Copy link
Contributor Author

jannes commented Aug 13, 2024

I may be wrong, but don't the logs show that the notification that is sent for clearFlycheck pass the wrong type of argument? There should be no argument but something is passsed, so it panics. Would appreciate if you take another look and tell me where I am wrong :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants