Skip to content

ICE on non-exhaustive match for fixed-size array (middle::check_match::construct_witness) #25051

Closed
@nwin

Description

@nwin

The following code

fn main() {
    let chunk_type: [u8; 4] = [73, 72, 68, 82];
    match &chunk_type {
        b"IHDR" => ()
    }
}

triggers an ICE:

error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'assertion failed: `(left == right)` (left: `1`, right: `4`)', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/librustc/middle/check_match.rs:542

stack backtrace:
   1:        0x10543524f - sys::backtrace::write::h0714aaf7fe41e02dzVr
   2:        0x10543d8c0 - panicking::on_panic::hb86b9b356f51f92dEVv
   3:        0x1053f9c35 - rt::unwind::begin_unwind_inner::h58f79e41dbedf2efnDv
   4:        0x1053faa6c - rt::unwind::begin_unwind_fmt::hab6b15880e0245d3tCv
   5:        0x102603c22 - middle::check_match::construct_witness::h63a10bcd13202cedwxf
   6:        0x1025e1a59 - middle::check_match::is_useful::hb75a5c814ba75ea2DKf
   7:        0x1025d92fb - middle::check_match::check_expr::h6324c4520c171c52V5e
   8:        0x1025dad3a - middle::check_match::check_fn::h6aab1644ec4857d5Vjg
   9:        0x1025db6e0 - visit::walk_item::h15813185597560382321
  10:        0x1025db4ca - middle::check_match::check_crate::haeae1a0cf20af28dy5e
  11:        0x101b80476 - driver::phase_3_run_analysis_passes::h2554ff95bce00587tGa
  12:        0x101b6118c - driver::compile_input::h7c6cf9b085c57594Qba
  13:        0x101c20ac3 - run_compiler::h55b523753cbd518765b
  14:        0x101c1e22a - boxed::F.FnBox<A>::call_box::h11476165885616507686
  15:        0x101c1d767 - rt::unwind::try::try_fn::h13518150216340287792
  16:        0x1054bfc58 - rust_try_inner
  17:        0x1054bfc45 - rust_try
  18:        0x101c1da4e - boxed::F.FnBox<A>::call_box::h735039165869315632
  19:        0x10543c2bd - sys::thread::Thread::new::thread_start::hf4c42a114072ab47mYu
  20:     0x7fff8eca9267 - _pthread_body
  21:     0x7fff8eca91e4 - _pthread_start

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions