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

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

Closed
Dushistov opened this issue Jun 28, 2024 · 2 comments · Fixed by #17534
Labels
Broken Window Bugs / technical debt to be addressed immediately C-bug Category: bug

Comments

@Dushistov
Copy link

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

rust-analyzer 0.0.0 (9463d9e 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.
@Dushistov Dushistov added the C-bug Category: bug label Jun 28, 2024
@Veykril
Copy link
Member

Veykril commented Jun 28, 2024

This will need a reproduction snippet

@ibraheemdev
Copy link
Member

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

@Veykril Veykril added the Broken Window Bugs / technical debt to be addressed immediately label Jul 3, 2024
@bors bors closed this as completed in 848e0c4 Jul 3, 2024
lnicola pushed a commit to lnicola/rust that referenced this issue Jul 11, 2024
…eykril

fix: Skip match exhaustiveness checking if pattern type contains errors

Should fix rust-lang/rust-analyzer#17509, checking when errors are involved is generally a bad idea as the algorithm doesn't really expect error types in the first place I believe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Broken Window Bugs / technical debt to be addressed immediately C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants