rust-lang / rust-analyzer

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

entered unreachable code: uncaught type error: pattern (_ : {error}, _ : {error}) has inconsistent arity #17509

Closed Dushistov closed 3 hours ago

Dushistov commented 4 days ago

rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P)

rust-analyzer 0.0.0 (9463d9eea4 2024-06-28)

rustc version: (eg. output of rustc -V)

rustc 1.80.0-beta.4 (64a1fe671 2024-06-21)

editor or extension: (eg. VSCode, Vim, Emacs, etc. For VSCode users, specify your extension version; for users of other editors, provide the distribution if applicable)

Emacs

backtrace:


thread 'Worker' panicked at crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs:502:9:
internal error: entered unreachable code: uncaught type error: pattern (_ : {error}, _ : {error}) has inconsistent arity (expected arity <= 0)
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: <hir_ty::diagnostics::match_check::pat_analysis::MatchCheckCtx as ra_ap_rustc_pattern_analysis::PatCx>::bug
   3: ra_ap_rustc_pattern_analysis::usefulness::compute_exhaustiveness_and_usefulness
   4: ra_ap_rustc_pattern_analysis::usefulness::compute_match_usefulness
   5: hir_ty::diagnostics::expr::BodyValidationDiagnostic::collect
   6: hir::DefWithBody::diagnostics
   7: hir::ModuleDef::diagnostics
   8: hir::Module::diagnostics
   9: ide_diagnostics::diagnostics
  10: salsa::Cancelled::catch
  11: ide::Analysis::diagnostics
  12: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
  13: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  14: rust_analyzer::diagnostics::fetch_native_diagnostics
  15: core::ops::function::FnOnce::call_once{{vtable.shim}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread 'LspServer' panicked at /Users/evgeniy/projects/rust-infra/rust-analyzer/crates/stdx/src/thread/pool.rs:86:35:
called `Result::unwrap()` on an `Err` value: "SendError(..)"
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: stdx::thread::pool::Pool::spawn
   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 '<unnamed>' panicked at /Users/evgeniy/.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: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread 'main' panicked at /Users/evgeniy/.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: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: jod_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.

Process rust-analyzer stderr<1> finished

Process rust-analyzer stderr finished
Panic context:
> fetch_native_diagnostics

thread 'Worker' panicked at crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs:502:9:
internal error: entered unreachable code: uncaught type error: pattern (_ : {error}, _ : {error}) has inconsistent arity (expected arity <= 0)
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: <hir_ty::diagnostics::match_check::pat_analysis::MatchCheckCtx as ra_ap_rustc_pattern_analysis::PatCx>::bug
   3: ra_ap_rustc_pattern_analysis::usefulness::compute_exhaustiveness_and_usefulness
   4: ra_ap_rustc_pattern_analysis::usefulness::compute_match_usefulness
   5: hir_ty::diagnostics::expr::BodyValidationDiagnostic::collect
   6: hir::DefWithBody::diagnostics
   7: hir::ModuleDef::diagnostics
   8: hir::Module::diagnostics
   9: ide_diagnostics::diagnostics
  10: salsa::Cancelled::catch
  11: ide::Analysis::diagnostics
  12: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
  13: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  14: rust_analyzer::diagnostics::fetch_native_diagnostics
  15: core::ops::function::FnOnce::call_once{{vtable.shim}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Veykril commented 4 days ago

This will need a reproduction snippet

ibraheemdev commented 3 hours ago

This error is consistently causing my rust-analyzer to crash as well.