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

Unexpected type for Struct constructor: AssocTypeId #18673

Open
lnicola opened this issue Dec 12, 2024 · 1 comment
Open

Unexpected type for Struct constructor: AssocTypeId #18673

lnicola opened this issue Dec 12, 2024 · 1 comment
Labels
A-pattern pattern handling related things C-bug Category: bug I-panic

Comments

@lnicola
Copy link
Member

lnicola commented Dec 12, 2024

for ()<|> 
let x = 4;
thread 'Worker' panicked at crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs:403:21:
internal error: entered unreachable code: Unexpected type for `Struct` constructor: AssocTypeId(3435)<[?0 := Bool]>
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>::ctor_sub_tys
   3: ra_ap_rustc_pattern_analysis::usefulness::compute_exhaustiveness_and_usefulness
   4: ra_ap_rustc_pattern_analysis::usefulness::compute_exhaustiveness_and_usefulness
   5: ra_ap_rustc_pattern_analysis::usefulness::compute_match_usefulness
   6: hir_ty::diagnostics::match_check::pat_analysis::MatchCheckCtx::compute_match_usefulness
   7: hir_ty::diagnostics::expr::BodyValidationDiagnostic::collect
   8: hir::DefWithBody::diagnostics
   9: hir::ModuleDef::diagnostics
  10: hir::Module::diagnostics
  11: ide_diagnostics::semantic_diagnostics
  12: ide_diagnostics::full_diagnostics
  13: std::panic::catch_unwind
  14: ra_salsa::Cancelled::catch
  15: ide::Analysis::assists_with_fixes
  16: rust_analyzer::handlers::request::handle_code_action
  17: std::panic::catch_unwind
  18: core::ops::function::FnOnce::call_once{{vtable.shim}}

This is the same panic that was reported in #17031.

@lnicola lnicola added A-pattern pattern handling related things C-bug Category: bug I-panic labels Dec 12, 2024
@lnicola lnicola changed the title Unexpected type for Struct constructor Unexpected type for Struct constructor: AssocTypeId Dec 12, 2024
@Veykril
Copy link
Member

Veykril commented Dec 12, 2024

Interesting we parse the let as a let expression for the iterable 😅

A reproducer without syntax errors

for () in true {}

@Veykril Veykril self-assigned this Dec 12, 2024
@Veykril Veykril removed their assignment Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-pattern pattern handling related things C-bug Category: bug I-panic
Projects
None yet
Development

No branches or pull requests

2 participants