Skip to content

ICE: panic on static array element in match arm #24375

Closed
@offlinemark

Description

@offlinemark

I tried this code (http://is.gd/NU1Rx1):

static tmp : [&'static str; 2]  = ["hello", "he"];

fn main() {
    let z = "hello";
    match z {
        tmp[0] => {}
        _ => {}
    }
}

and got this output:

asd.rs:6:9: 6:12 error: internal compiler error: ident only path should have been covered already
asd.rs:6         tmp[0] => {}
                 ^~~
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 'Box<Any>', /Users/rustbuild/src/rust-buildbot/slave/beta-dist-rustc-mac/build/src/libsyntax/diagnostic.rs:130

stack backtrace:
   1:        0x112969f77 - sys::backtrace::write::h799ab135045ca9ca1LC
   2:        0x112997e4d - panicking::on_panic::h9502e488a92fc8bcHAI
   3:        0x1128bc2de - rt::unwind::begin_unwind_inner::hf0537788ee16eadbiiI
   4:        0x11208b5ae - rt::unwind::begin_unwind::h447731439410619827
   5:        0x11208b55b - diagnostic::SpanHandler::span_bug::h3f51c1d819f22bcfjnB
   6:        0x1120b578e - parse::parser::Parser<'a>::parse_pat::hb459659c414ae6ecADH
   7:        0x1120ca517 - parse::parser::Parser<'a>::parse_arm::h19481f6d15d5424dssH
   8:        0x1120c0039 - parse::parser::Parser<'a>::parse_bottom_expr::h96c1a8fd1f0b7942dsG
   9:        0x1120c5732 - parse::parser::Parser<'a>::parse_dot_or_call_expr::he885726c5a4545e2bLG
  10:        0x1120c8666 - parse::parser::Parser<'a>::parse_prefix_expr::hd6b8f4ec03139732x5G
  11:        0x1120c8c12 - parse::parser::Parser<'a>::parse_binops::hff710c06e4b6f32cxaH
  12:        0x1120c946c - parse::parser::Parser<'a>::parse_assign_expr::h41ec79cdb842d3c8efH
  13:        0x1120cc511 - parse::parser::Parser<'a>::parse_stmt_::h7ede436432b951741XH
  14:        0x1120c4989 - parse::parser::Parser<'a>::parse_block_tail::hd91f708bd4c213bdl8H
  15:        0x1120aebe5 - parse::parser::Parser<'a>::parse_inner_attrs_and_block::h5c3c6889b98d497be7H
  16:        0x1120d9245 - parse::parser::Parser<'a>::parse_item_fn::h807772908f7bc1b8pII
  17:        0x1120cf76f - parse::parser::Parser<'a>::parse_item_::he14d9510111343dejyJ
  18:        0x1120df5f5 - parse::parser::Parser<'a>::parse_mod_items::he399e856ba8f3042o4I
  19:        0x1120e602a - parse::parser::Parser<'a>::parse_crate_mod::h10dd730252c4c6f67WJ
  20:        0x1120fc676 - parse::parse_crate_from_file::h32556cf8a5800c59iMQ
  21:        0x10edca4be - driver::phase_1_parse_input::closure.15599
  22:        0x10eda146b - driver::phase_1_parse_input::hda4b70999233c292Nqa
  23:        0x10ed9d7a2 - driver::compile_input::h27cf4320fd56e5cbQba
  24:        0x10ee5ca15 - run_compiler::h93c68a2a3c26052bV4b
  25:        0x10ee5a1e2 - boxed::F.FnBox<A>::call_box::h4498816167135712709
  26:        0x10ee596d7 - rt::unwind::try::try_fn::h2387014819904265058
  27:        0x112a21ea8 - rust_try_inner
  28:        0x112a21e95 - rust_try
  29:        0x10ee599ca - boxed::F.FnBox<A>::call_box::h4850138824497903476
  30:        0x11298137d - sys::thread::create::thread_start::h42d6d904fce5365aihH
  31:     0x7fff91fc3267 - _pthread_body
  32:     0x7fff91fc31e4 - _pthread_start

so here is my bug report!

bash-3.2$ rustc --version --verbose
rustc 1.0.0-beta (9854143cb 2015-04-02) (built 2015-04-02)
binary: rustc
commit-hash: 9854143cba679834bc4ef932858cd5303f015a0e
commit-date: 2015-04-02
build-date: 2015-04-02
host: x86_64-apple-darwin
release: 1.0.0-beta

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-parserArea: The lexing & parsing of Rust source code to an ASTI-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