Skip to content

unexpected panic in pattern matching #23009

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

Closed
pmachata opened this issue Mar 3, 2015 · 0 comments · Fixed by #23313
Closed

unexpected panic in pattern matching #23009

pmachata opened this issue Mar 3, 2015 · 0 comments · Fixed by #23313
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@pmachata
Copy link

pmachata commented Mar 3, 2015

This is the code that ICEs, as minimal as I could make it.

fn main() {
    let mut v = vec![1, 2, 3];

    match &v[..] {
        [1, ref n, 3] => {},
        [1, 2, 3] => {},
    }
}
$ RUST_BACKTRACE=1 rustc ble.rs
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 'index out of bounds: the len is 0 but the index is 0', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustc/middle/check_match.rs:658

stack backtrace:
   1:         0x5c1b4c4f - sys::backtrace::write::hb08af03691eab78a5kA
   2:         0x5c1dd782 - panicking::on_panic::h37164609ca1c02afBnJ
   3:         0x5c11d63a - rt::unwind::begin_unwind_inner::h24d5e7492198457b43I
   4:         0x5c11dd24 - rt::unwind::begin_unwind_fmt::hee1a09c48e390d87H2I
   5:         0x5c1dd307 - rust_begin_unwind
   6:         0x5c226cb4 - panicking::panic_fmt::h129020744e7a1c43Z9r
   7:         0x5c23022c - panicking::panic_bounds_check::h42fcb0eaffcd0f1058r
   8:         0x59fa83ca - middle::check_match::is_useful::h564cfcfb5611bfb3FRf
   9:         0x59fd47c5 - middle::check_match::is_useful_specialized::h6723fd8117540027XZf
  10:         0x59fd5641 - middle::check_match::is_useful::closure.75994
  11:         0x59fd5309 - iter::Map<I, F>.Iterator::next::h6922741939313682342
  12:         0x59fa783a - middle::check_match::is_useful::h564cfcfb5611bfb3FRf
  13:         0x59fd47c5 - middle::check_match::is_useful_specialized::h6723fd8117540027XZf
  14:         0x59fd5641 - middle::check_match::is_useful::closure.75994
  15:         0x59fd5309 - iter::Map<I, F>.Iterator::next::h6922741939313682342
  16:         0x59fa783a - middle::check_match::is_useful::h564cfcfb5611bfb3FRf
  17:         0x59fd47c5 - middle::check_match::is_useful_specialized::h6723fd8117540027XZf
  18:         0x59fd5641 - middle::check_match::is_useful::closure.75994
  19:         0x59fd5309 - iter::Map<I, F>.Iterator::next::h6922741939313682342
  20:         0x59fa783a - middle::check_match::is_useful::h564cfcfb5611bfb3FRf
  21:         0x59fd47c5 - middle::check_match::is_useful_specialized::h6723fd8117540027XZf
  22:         0x59fd5641 - middle::check_match::is_useful::closure.75994
  23:         0x59fd5309 - iter::Map<I, F>.Iterator::next::h6922741939313682342
  24:         0x59fa783a - middle::check_match::is_useful::h564cfcfb5611bfb3FRf
  25:         0x59fa0852 - middle::check_match::check_expr::h40117a214c57fedfadf
  26:         0x59fa252a - middle::check_match::check_fn::h951fa0814382c1eaKpg
  27:         0x59fa2d8c - visit::walk_item::h4129520673127106273
  28:         0x59fa2baa - middle::check_match::check_crate::hb09e09956c3438ffNcf
  29:         0x5c8364b2 - driver::phase_3_run_analysis_passes::h55e7e7af941f4089xFa
  30:         0x5c81a411 - driver::compile_input::hee81c045ab46c74fIba
  31:         0x5c8e4e6e - run_compiler::h875c1e123fe4ae2cF5b
  32:         0x5c8e2a1c - thunk::F.Invoke<A, R>::invoke::h14796375338076039584
  33:         0x5c8e1770 - rt::unwind::try::try_fn::h17889328263510442428
  34:         0x5c248fe8 - rust_try_inner
  35:         0x5c248fd5 - rust_try
  36:         0x5c8e1e5c - thunk::F.Invoke<A, R>::invoke::h2091551127524498175
  37:         0x5c1c92d5 - sys::thread::thread_start::h1b1bb1e7ac08d3a6yRE
  38:         0x55eeb529 - start_thread
  39:         0x5bda379c - clone
  40:         0xffffffff - <unknown>
$ rustc --version --verbose
rustc 1.0.0-nightly (890293655 2015-02-28) (built 2015-03-01)
binary: rustc
commit-hash: 890293655251c372ea99694c0c9f0795e2663286
commit-date: 2015-02-28
build-date: 2015-03-01
host: x86_64-unknown-linux-gnu
release: 1.0.0-nightly
@steveklabnik steveklabnik added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Mar 3, 2015
barosl added a commit to barosl/rust that referenced this issue Mar 14, 2015
The arity of `ref x` is always 1, so it needs to be dereferenced before
being compared with some other type whose arity is not 1.

Fixes rust-lang#23009.
bors added a commit that referenced this issue Mar 15, 2015
The arity of `ref x` is always 1, so it needs to be dereferenced before being compared with some other type whose arity is not 1.

Fixes #23009.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants